mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2025-09-24 15:31:31 +02:00
Compare commits
6 commits
45c45e2e11
...
66ca973686
Author | SHA1 | Date | |
---|---|---|---|
![]() |
66ca973686 |
||
![]() |
768d17f077 |
||
![]() |
36c5ec22ae |
||
![]() |
f71fed2884 |
||
![]() |
d545dc682e |
||
![]() |
80e3399d0c |
19 changed files with 154 additions and 803 deletions
|
@ -56,7 +56,6 @@ with builtins; {
|
|||
lolcat
|
||||
cool-retro-term
|
||||
|
||||
maven
|
||||
jetbrains.idea-ultimate
|
||||
jdk
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
||||
pkgs-unstable-small = nixpkgs-unstable-small.legacyPackages.${system};
|
||||
crane-lib = crane.mkLib nixpkgs.legacyPackages.${system};
|
||||
rs-toolchain = with fenix.packages.${system};
|
||||
combine [
|
||||
complete.toolchain
|
||||
|
@ -59,6 +58,7 @@
|
|||
# cargo = rs-toolchain;
|
||||
# rustc = rs-toolchain;
|
||||
# };
|
||||
crane-lib = (crane.mkLib nixpkgs.legacyPackages.${system}).overrideToolchain rs-toolchain;
|
||||
rs-programs = final: prev: {
|
||||
# s10e-jrnl = rs-platform.buildRustPackage {
|
||||
# pname = "jrnl";
|
||||
|
|
|
@ -40,12 +40,6 @@
|
|||
|
||||
networking.hostName = "monosodium-glutamate-g";
|
||||
services = {
|
||||
xserver = {
|
||||
layout = "us";
|
||||
xkbVariant = "altgr-intl";
|
||||
enable = true;
|
||||
};
|
||||
|
||||
openssh.settings.PermitRootLogin = "without-password";
|
||||
|
||||
blueman.enable = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{pkgs, ...}: {
|
||||
environment.systemPackages = [
|
||||
pkgs.nvtop-amd
|
||||
pkgs.nvtopPackages.amd
|
||||
pkgs.radeontop
|
||||
pkgs.rgp
|
||||
];
|
||||
|
|
|
@ -67,24 +67,10 @@
|
|||
|
||||
services.libinput.touchpad = {
|
||||
disableWhileTyping = true;
|
||||
tapping = false;
|
||||
};
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
networking.hostName = "potatobook-g";
|
||||
|
||||
services.xserver = {
|
||||
resolutions = [
|
||||
{
|
||||
x = 1920;
|
||||
y = 1200;
|
||||
}
|
||||
];
|
||||
# dpi = 180;
|
||||
layout = "us";
|
||||
xkbVariant = "altgr-intl";
|
||||
};
|
||||
|
||||
services.autorandr = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
|
|
|
@ -15,15 +15,42 @@ const ICONS = [
|
|||
[ ]
|
||||
];
|
||||
|
||||
const DELAY = 2sec;
|
||||
|
||||
def "main auto" [] {
|
||||
loop {
|
||||
let paths = ls "/sys/class/power_supply"
|
||||
| each {|it| $it.name | path basename}
|
||||
| filter {|it| $it starts-with "BAT"};
|
||||
|
||||
if ($paths | is-not-empty) {
|
||||
let result = $paths
|
||||
| each {|it| get_and_format $it}
|
||||
| str join " | "
|
||||
| prepend "| "
|
||||
| str join;
|
||||
|
||||
print $result
|
||||
} else {
|
||||
print ""
|
||||
}
|
||||
sleep $DELAY;
|
||||
}
|
||||
}
|
||||
|
||||
def main [ path: string ] {
|
||||
loop {
|
||||
print (get_and_format $path)
|
||||
sleep $DELAY;
|
||||
}
|
||||
}
|
||||
|
||||
def get_and_format [ path: string ] {
|
||||
let fract = get_bat_charge_fraction $path;
|
||||
let is_charging = get_bat_charging_status $path;
|
||||
let percent = ($fract * 100) | math round;
|
||||
|
||||
print $"<span foreground=\"#d65d0e\">(get_bat_icon $fract $is_charging)</span> ($percent)<span foreground=\"#7c6f64\">%</span>";
|
||||
sleep 2sec;
|
||||
}
|
||||
|
||||
return $"<span foreground=\"#d65d0e\">(get_bat_icon $fract $is_charging)</span> ($percent)<span foreground=\"#7c6f64\">%</span>";
|
||||
}
|
||||
|
||||
def get_bat_charge_fraction [
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
(deflisten bat0
|
||||
(deflisten bat
|
||||
:initial "<span foreground=\"#cc241d\">BAT0 ERR</span>"
|
||||
{ "~/.config/eww/scripts/bat.nu BAT0"}
|
||||
)
|
||||
(deflisten bat1
|
||||
:initial "<span foreground=\"#cc241d\">BAT1 ERR</span>"
|
||||
{ "~/.config/eww/scripts/bat.nu BAT1"}
|
||||
{ "~/.config/eww/scripts/bat.nu auto"}
|
||||
)
|
||||
|
||||
(defwidget cpu []
|
||||
|
|
|
@ -27,10 +27,7 @@
|
|||
(cpu)
|
||||
(sep)
|
||||
(mem)
|
||||
(sep)
|
||||
(label :markup bat0)
|
||||
(sep)
|
||||
(label :markup bat1)
|
||||
(label :markup bat)
|
||||
)
|
||||
(box
|
||||
:halign "center"
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
hash = "sha256-SzAuVFEy56svasO3+1p6ysBRrIQd0UZX++/P4ZuwWm0=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-liWP6AI72xG1O+MbCZ0cjJ2llHj/iv3hR/U3BLv5fKA=";
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-QVxlkE+sq4U048LnshI/tq6HInKiSgjQLAdR+27/wEI=";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Layout creation for Sway via a relative and human-readable DSL.";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.jade.desktop.gaming;
|
||||
|
@ -16,7 +15,6 @@ in
|
|||
home.packages = with pkgs; [
|
||||
lutris
|
||||
prismlauncher
|
||||
legendary-gl
|
||||
wineWowPackages.stable
|
||||
dxvk_2
|
||||
vkd3d-proton
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
80
|
||||
443
|
||||
|
||||
# syncthing web ui
|
||||
8384
|
||||
|
||||
# syncthing
|
||||
22000
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
utils,
|
||||
...
|
||||
}: let
|
||||
cfg = config.jade.input.remapping;
|
||||
|
@ -15,11 +14,8 @@
|
|||
rev = "4480c4eda223b98899b0fbd926bc34f7bd0e1a18";
|
||||
sha256 = "sha256-BxSrphgW1n465FX6bKVkq6O0XE2JqanfSYlsGwWUWkQ=";
|
||||
};
|
||||
cargoHash = "";
|
||||
cargoLock.lockFile = ../../other/evremap.Cargo.lock;
|
||||
postPatch = ''
|
||||
cp ${../../other/evremap.Cargo.lock} Cargo.lock
|
||||
'';
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-O1rJ48m8Q7kZABw/UNpmUT7FFBWQedo6CuV+NX9kDt8=";
|
||||
nativeBuildInputs = [pkgs.pkg-config];
|
||||
buildInputs = [pkgs.libevdev];
|
||||
};
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{...}: {
|
||||
home-manager.users.jade = {pkgs, ...}: {
|
||||
programs.carapace = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -3,9 +3,6 @@
|
|||
./helix.nix
|
||||
./nu.nix
|
||||
./starship.nix
|
||||
./zellij.nix
|
||||
./carapace.nix
|
||||
./direnv.nix
|
||||
./tty.nix
|
||||
./git.nix
|
||||
./mprocs.nix
|
||||
|
@ -13,4 +10,8 @@
|
|||
];
|
||||
programs.mosh.enable = true;
|
||||
programs.bat.enable = true;
|
||||
home-manager.users.jade = {...}: {
|
||||
programs.carapace.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{...}: {
|
||||
home-manager.users.jade = {pkgs, ...}: {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -58,8 +58,8 @@ in {
|
|||
enable = true;
|
||||
fonts = [
|
||||
{
|
||||
name = "FiraCode Nerd Font";
|
||||
package = pkgs.nerd-fonts.fira-code;
|
||||
name = "Departure Mono Nerd Font";
|
||||
package = pkgs.nerd-fonts.departure-mono;
|
||||
}
|
||||
];
|
||||
extraConfig = "font-size=14";
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home-manager.users.jade = {pkgs, ...}: {
|
||||
programs.zellij = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme = "gruvbox-dark";
|
||||
themes.gruvbox-dark = {
|
||||
fg = "#d5c4a1";
|
||||
bg = "#282828";
|
||||
black = "#3C3836";
|
||||
red = "#CC241D";
|
||||
green = "#98971A";
|
||||
yellow = "#D79921";
|
||||
blue = "#3C8588";
|
||||
magenta = "#B16286";
|
||||
cyan = "#689D6A";
|
||||
white = "#ebdbb2";
|
||||
orange = "#D65D0E";
|
||||
};
|
||||
pane_frames = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
693
other/evremap.Cargo.lock
generated
693
other/evremap.Cargo.lock
generated
|
@ -1,693 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time",
|
||||
"wasm-bindgen",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"strsim",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||
dependencies = [
|
||||
"termcolor",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||
|
||||
[[package]]
|
||||
name = "cxx"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cxxbridge-flags",
|
||||
"cxxbridge-macro",
|
||||
"link-cplusplus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx-build"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-flags"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78"
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-macro"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "evdev-rs"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95f73dad019df28348aad51f059684bdf628822325c26d34fbe126e513369799"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"evdev-sys",
|
||||
"libc",
|
||||
"log",
|
||||
"nix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "evdev-sys"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14ead42b547b15d47089c1243d907bcf0eb94e457046d3b315a26ac9c9e9ea6d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "evremap"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"evdev-rs",
|
||||
"libc",
|
||||
"log",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"structopt",
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||
dependencies = [
|
||||
"quick-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
|
||||
dependencies = [
|
||||
"cxx",
|
||||
"cxx-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.135"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
|
||||
|
||||
[[package]]
|
||||
name = "link-cplusplus"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
||||
|
||||
[[package]]
|
||||
name = "pretty_env_logger"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"env_logger",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
||||
|
||||
[[package]]
|
||||
name = "scratch"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.145"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.145"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"lazy_static",
|
||||
"structopt-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.102"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
@ -1,4 +1,22 @@
|
|||
use std::io::{Read, Write};
|
||||
#![feature(iter_array_chunks)]
|
||||
#![feature(round_char_boundary)]
|
||||
#![feature(iter_collect_into)]
|
||||
#![feature(pattern)]
|
||||
|
||||
use std::{
|
||||
hint::black_box,
|
||||
io::{Read, Write},
|
||||
str::pattern::Pattern,
|
||||
};
|
||||
|
||||
const BOOL_COUNT: usize = BOOLS.len();
|
||||
const BOOLS: &[[&str; 2]] = &[
|
||||
["false", "true"],
|
||||
["False", "True"],
|
||||
["FALSE", "TRUE"],
|
||||
["0", "1"],
|
||||
["no", "yes"],
|
||||
];
|
||||
|
||||
fn main() {
|
||||
let mut input = String::new();
|
||||
|
@ -7,19 +25,95 @@ fn main() {
|
|||
|
||||
stdin.read_to_string(&mut input).unwrap();
|
||||
|
||||
let bool_locs = find_bools(&input);
|
||||
stdout
|
||||
.write_all(match input.as_bytes() {
|
||||
b"true" => b"false",
|
||||
b"True" => b"False",
|
||||
b"TRUE" => b"FALSE",
|
||||
b"false" => b"true",
|
||||
b"False" => b"True",
|
||||
b"FALSE" => b"TRUE",
|
||||
b"1" => b"0",
|
||||
b"yes" => b"no",
|
||||
b"0" => b"1",
|
||||
b"no" => b"yes",
|
||||
other => other,
|
||||
})
|
||||
.write_all(replace_bools(&mut input, bool_locs).as_bytes())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
type BoolLocs = [[Vec<usize>; 2]; BOOL_COUNT];
|
||||
|
||||
// you thought [`find_bools`] was stupid? this is *so* much worse!!!
|
||||
fn replace_bools(input: &str, mut bool_locs: BoolLocs) -> String {
|
||||
let mut result = String::with_capacity(input.len());
|
||||
let mut intermediate = input;
|
||||
let mut flattened = bool_locs
|
||||
.iter_mut()
|
||||
.flatten()
|
||||
.map(|vec| {
|
||||
vec.reverse();
|
||||
vec
|
||||
})
|
||||
.enumerate()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut smallest = || {
|
||||
let min_idx = flattened
|
||||
.iter()
|
||||
.min_by(|va, vb| {
|
||||
va.1.last()
|
||||
.unwrap_or(&usize::MAX)
|
||||
.cmp(vb.1.last().unwrap_or(&usize::MAX))
|
||||
})?
|
||||
.0;
|
||||
|
||||
Some((min_idx, flattened[min_idx].1.pop()?))
|
||||
};
|
||||
|
||||
let mut input_idx = 0;
|
||||
while let Some(item) = smallest() {
|
||||
let (a, b) = intermediate.split_at(item.1 - input_idx);
|
||||
input_idx += a.len();
|
||||
result += a;
|
||||
let bool_ = &BOOLS[item.0 / 2];
|
||||
input_idx += bool_[item.0 % 2].len();
|
||||
result += bool_[if item.0 % 2 == 0 { 1 } else { 0 }];
|
||||
let (_, b) = b.split_at(bool_[item.0 % 2].len());
|
||||
intermediate = b;
|
||||
}
|
||||
|
||||
result + intermediate
|
||||
}
|
||||
|
||||
// this is so fucking stupid
|
||||
// it also would've been way easier using a regex crate lmao
|
||||
fn find_bools(input: &str) -> [[Vec<usize>; 2]; BOOL_COUNT] {
|
||||
let mut res = Vec::with_capacity(BOOL_COUNT);
|
||||
BOOLS
|
||||
.iter()
|
||||
.flatten()
|
||||
.map(|it| {
|
||||
input
|
||||
.match_indices(it)
|
||||
.filter_map(|it| {
|
||||
let char_guard = |c: char| !(c.is_alphanumeric() || c.is_contained_in("-_"));
|
||||
let mut allow = true;
|
||||
|
||||
if it.0 > 0 {
|
||||
allow &= char_guard(
|
||||
input[it.1.floor_char_boundary(it.0 - 1)..it.0]
|
||||
.chars()
|
||||
.last()
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
let last_idx = it.0 + it.1.len();
|
||||
if last_idx < input.len() {
|
||||
allow &= char_guard(
|
||||
input[(last_idx)..(input.ceil_char_boundary(last_idx + 1))]
|
||||
.chars()
|
||||
.last()
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
allow.then_some(it.0)
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.array_chunks::<2>()
|
||||
.collect_into(&mut res);
|
||||
|
||||
res.try_into().unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue