repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

280d8f1666f3dd3ed9299d654dd9f52896561905

Oliver Krylow <o.krylow@isp-insoft.de> ·

unsigned

Browse filesCompare with HEAD

Changed files (23)

+336 / −268 text lines

Diff layout

.gitignore

Modified

+2 / −1 text lines

55bootstripper/win32/cross9
66tresor/box_do_key
77nushell/zoxide.nu
8nushell/history.txtNo final newline
8nushell/history.txt
9nushell/plugin.nu

COMMANDS.md

Modified

+0 / −4 text lines

1212- tokei: count lines of code
1313- hyperfine: benchmark tool
1414- menyoki: capture screenshots, record gifs
15- rpick: Choose something out of predefined model using fancy algorithms
1615- tldr: tool documentation
1716- grex: regular expression pattern generator
1817- xh: make HTTP requests
19- watchexec: filesystem watcher
2018- viu: view images in terminal (blocky approximation)
2119- licensor: print a license text
2220- pastel: manage colors
3129- comrak: render markdown to html
3230- hx: terminal code editor
3331- xplr: terminal file explorer
34- coreutils: rust unix tools
3532- t-rec: terminal gifs
3633- podcast: podcast manager
3734- sic: image manipulation
3835- vivid: generate LS_COLORS
3936- chars: unicode character info
40- hwatch: watch output of commands over time
4137- franklin-cli: evolutionary image filter
4238- uggo: LoL builds

PC-00625.symlinks

Added
new file mode 100644

+35 / −0 text lines

1git/gitconfig
2~/.gitconfig
3
4git/gitconfig.PC-00625
5~/.gitconfig.include
6
7topgrade/topgrade.windows.toml
8~/AppData/Roaming/topgrade.toml
9
10nushell
11~/AppData/Roaming/nushell
13bottom
14~/AppData/Roaming/bottom
16stackoverflow/so
17~/AppData/Roaming/Sam Tay/so
19subversion/config
20~/AppData/Roaming/Subversion/config
22cargo/config.toml
23~/.cargo/config.toml
25indexa/config.windows.toml
26~/AppData/Roaming/indexa/config.toml
28wezterm
29~/.config/wezterm
31helix/config.toml
32~/AppData/Roaming/helix/config.toml
34helix/themes
35~/AppData/Roaming/helix/themesNo final newline

README.md

Modified

+8 / −1 text lines

881. Install a JDK
991. git clone git@github.com:bugabinga/dotfiles
10101. `cd dotfiles`
111. `java bootstripper.java .`
111. `java bootstripper.java`
1313> Pay attention to already existing symlinks!
15## windows
17Initial setup on windows is a little more sophisticated, because I am used to a developers environment.
191. Enable Devoloper Mode, so that it is allowed to make symlinks without admin permissions.
201. Install Build Tools with C++ Option (for Rust and cargo tools)
1522## rough goals
1724- minimal amount of dependencies

bootstripper.java

Modified

+11 / −5 text lines

2020 decrypt_secrets(dorkfiles_root.resolve("tresor"));
2121 var hostname = hostname();
2222 log("Hostname: {0}", emphasize_global(hostname));
23 var symlinks_file = hostname + ".symlinks";
24 create_symlinks(dorkfiles_root, dorkfiles_root.resolve(symlinks_file));
23 var symlinks_file = dorkfiles_root.resolve(hostname + ".symlinks");
24 if (Files.exists(symlinks_file)) {
25 create_symlinks(dorkfiles_root, symlinks_file);
26 } else {
27 throw fail("Expected a file containing symlinks at: {0}. Found nothing!", symlinks_file);
28 }
2529 }
2731 static void decrypt_secrets(Path secrets_root) throws Throwable {
5761 var is_directory = Files.isDirectory(source_path);
5862 if (Files.exists(target_path, LinkOption.NOFOLLOW_LINKS)) {
5963 if (Files.exists(target_path)) {
60 log("\n✓ {0} already exists!\nNot linking {1}.", emphasize_global(target_path.toString()),
64 log("\nOK {0} already exists!\nNot linking {1}.", emphasize_global(target_path.toString()),
6165 emphasize_local(source_path.toString()));
6266 return;
6367 } else {
64 log("\n❌ {0} exists, but it points into nirvana. Removing broken link!", target_path.toString());
68 log("\nNOPE {0} exists, but it points into nirvana. Removing broken link!", target_path.toString());
6569 Files.delete(target_path);
6670 }
6771 }
68 log("\n🔗 {0} ➔ {1}.", emphasize_local(source_path.toString()),
72 log("\nLINK {0} TO {1}.", emphasize_local(source_path.toString()),
6973 emphasize_local(target_path.toString()));
7074 Files.createDirectories(target_path.getParent());
7175 try {
7478 /*
7579 * Creating symbolic links on Windows only recently became possible without
7680 * admin rights.
81 * And even that, is only available in Developer Mode.
7782 * However, most tools (including JDK) have not yet adapted to this change and
7883 * still require admin rights.
7984 * Until that is fixed, we escape to a system tool that is known to behave
9196 }
9297 command.add(target_path.toString());
9398 command.add(source_path.toString());
99 log(command.toString());
94100 process.inheritIO()
95101 .start()
96102 .onExit()

cargo/config.toml

Modified

+1 / −10 text lines

88# aaand we get out of memory errors when building nu...
99[profile.release]
1010# link time optimization is slow, but allows inter-crate analysis
11# lto = "fat"
13[target.x86_64-pc-windows-msvc]
14# apparently, the LLVM linker is faster than others...
15linker = "lld-link.exe"
17[target.x86_64-unknown-linux-gnu]
18rustflags = [
19"-C", "link-arg=-fuse-ld=lld",
20]
11lto = "fat"

git/gitconfig

Modified

+0 / −3 text lines

1# This is Git's per-user configuration file.
21[user]
32 name = Oliver Jan Krylow
43 email = olver@bugabinga.net
5958# On each host a different file might be symlinked into '.gitconfig.include'.
6059[include]
6160 path = .gitconfig.include
62[credential "helperselector"]
63 selected = manager-core

git/gitconfig.PC-00625

Added
new file mode 100644

+19 / −0 text lines

1[user]
2 name = Oliver Krylow
3 email = o.krylow@isp-insoft.de
4
5[credential]
6 helper = manager-core
7
8[credential "helperselector"]
9 selected = manager-core
11[core]
12 editor = code --wait
13 fsmonitor=true
15[diff]
16 tool = code-difftool
18[difftool "code-difftool"]
19 cmd = code --wait --diff $LOCAL $REMOTENo final newline

indexa/config.windows.toml

Modified

+1 / −2 text lines

5252# Root directories to index. Defaults to / on Unix and %HOMEDRIVE%\ (usually C:\) on Windows.
5353dirs = [
54 "C:\\",
55 "D:\\"
54 "C:\\"
5655 ]
5857# Whether to ignore hidden files/directories.

nushell/config.nu

Modified

+2 / −1 text lines

11# Nushell Config File
2use environment.nu *
32use table.nu *
43use os.nu *
54use prompt.nu *
65use aliases.nu *
76use todo.nu *
87use git.nu *
8use svn.nu *
9use openssl.nu *
1011# CUSTOM COMPLETIONS
1112use svn.complete.nu *

nushell/env.nu

Modified

+9 / −2 text lines

1# GLOBAL VARIABLES
2
3let-env WIN32? = $nu.os-info.name =~ "windows"
4let-env NURC_DIR = ($nu.config-path| path expand | path dirname)
5let-env DOTFILES = ($env.NURC_DIR| path join ".." | path expand)
6let-env WORKSPACE = if $env.WIN32? { "W:/misc" } else { "~/Workspace" }
7let-env CARGO_HOME = if $env.WIN32? { "C:/Users/okr/.cargo" } else { "~/.cargo" }
8
19# Specifies how environment variables are:
210# - converted from a string to a value on Nushell startup (from_string)
311# - converted from a value back to a string when running external commands (to_string)
1624# Directories to search for scripts when calling source or use
1725let-env NU_LIB_DIRS = [
18 ($nu.config-path | path dirname | path join 'tools'),
1926 ($nu.config-path | path dirname | path join 'modules'),
2027 ($nu.config-path | path dirname | path join 'completions')
2431let-env NU_PLUGIN_DIRS = [
2532 ($nu.config-path | path dirname | path join 'plugins'),
2633 ($env.CARGO_HOME | path join 'bin'),
27]
34]No final newline

nushell/modules/aliases.nu

Modified

+11 / −0 text lines

66export alias browse = firefox
77export alias edit = hx
9# wrapper to delegate to gsudo/sudo if available.
10export def doas [
11 ...rest: string # arguments
12] {
13 if ( which "sudo" | empty? ) {
14 ^doas $rest
15 } else {
16 ^sudo $rest
17 }
18}
920# CUSTOM LITTLE JAVA COMMANDS
1021export alias aes = java (build-string $env.DOTFILES /tools/ aes.java)
1122export alias download = java (build-string $env.DOTFILES /tools/ download.java)

nushell/modules/environment.nu

Deleted
deleted file mode 100644

+0 / −16 text lines

1export env GO111MODULE { "on" }
2export env GOPATH { ($nu.home-path | path join '.go') }
3
4export env PATH {
5 ( $env.PATH |
6 prepend ($env.GOPATH | path join 'bin')
7 )
8 }
9#TODO CARGO_HOME
11# GLOBAL VARIABLES
13export env WIN32? { (sys).host.name =~ "Windows" }
14export env NURC_DIR { ($nu.config-path| path expand | path dirname) }
15export env DOTFILES { ($env.NURC_DIR| path join ".." | path expand) }
16export env WORKSPACE { if $env.WIN32? { "W:" } else { "~/Workspace" } }

nushell/modules/openssl.nu

Added
new file mode 100644

+6 / −0 text lines

1# Generate a new ed25519 SSH private key
2export def ssh-keygen-ed [
3 email: string # Identifier for the COMMENT section of the key
4] {
5 ssh-keygen -t ed25519 -C $email
6}No final newline

nushell/modules/prompt.nu

Modified

+16 / −14 text lines

4646# Order these paths for precedence.
4747def icons [] {
4848 [
49 [path icon];
50 [/home/oli/Workspace "🧬"]
51 [/home/oli "🏡"]
49 [ path icon ];
50 [ "/home/oli/Workspace" (char -u "1f4bb") ]
51 [ "/home/oli" (char nf_house2) ]
52 [ "C:\\Users\\okr\\Workspaces" (char -u "1f4bb") ]
53 [ "C:\\Users\\okr" (char nf_house2) ]
5254 ]
5355}
5961def set-window-title [] {
6062 # normalize path
6163 let pwd = ( $env.PWD | path expand )
62 let icon = if (icons | any? path == $pwd) { ( icons | where path == $pwd | get icon.0 ) } else { "📁" }
64 let icon = if (icons | any? path == $pwd) { ( icons | where path == $pwd | get icon.0 ) } else { $"(char nf_folder1)" }
6365 # Some terminals freeze, if they do not support this OSC
6466 if (env | any? name == TERM_PROGRAM) && $env.TERM_PROGRAM == WezTerm {
6567 echo ([ (ansi title) $icon " " ( $pwd | path basename ) (ansi reset) ] | str collect)
7173 let pwd = ($env.PWD | path expand)
7375 let svn_relative_cmd = ( do --ignore-errors { ^svn info --show-item relative-url --no-newline $pwd } | complete )
74 let svn_relative_path = if ($svn_relative_cmd.exit_code == 0) { $" 🐢 ($svn_relative_cmd.stdout)" }
76 let svn_relative_path = if ($svn_relative_cmd.exit_code == 0) { $" 🐢 (char nf_branch) ($svn_relative_cmd.stdout)" }
7678 let git_status = ( gstat )
77 let git_branch = if ( $git_status.branch != "no_branch" ) { $" ($git_status.branch)" }
79 let git_branch = if ( $git_status.branch != "no_branch" ) { $" (char nf_git) (char nf_branch) ($git_status.branch)" }
7981 [
8082 $svn_relative_path
8991 # normalize path
9092 let pwd = ($env.PWD | path expand)
91 let pwd = (icons | reduce --fold $pwd { |item, accumulator| $accumulator | str replace $item.path $item.icon })
93 let pwd = (icons | reduce --fold $pwd { |item, accumulator| $accumulator | str replace --string $item.path $item.icon })
9294 let truncate_level = 5
93 let truncate_symbol = "…/"
95 let truncate_symbol = $"…(char path_sep)"
9496 let path_segment = if ($pwd | path split | length) >= $truncate_level { ($pwd | path dirname --num-levels 2 --replace $truncate_symbol ) } else { $pwd }
9698 let vcs_segment = get_vcs_path
110112 (date now | date format '%d.%m %R')
111113 ] | str collect)
113 let command_status_segment = if $env.LAST_EXIT_CODE == 0 { " ✔ " } else { $"(ansi red) ✖ (ansi reset)" }
114 let command_duration_segment = if ($env.CMD_DURATION_MS|into int) > 50 { build-string $"($env.CMD_DURATION_MS)ms" | into duration }
115 let command_status_segment = if $env.LAST_EXIT_CODE == 0 { $" (char -u '2713') " } else { $"(ansi red) (char failed) (ansi reset)" }
116 let command_duration_segment = if ($env.CMD_DURATION_MS | into int) > 50 { $"($env.CMD_DURATION_MS)ms" | into duration }
116118 [
117119 (ansi red_bold)
133135# The prompt indicators are environmental variables that represent
134136# the state of the prompt
135export env PROMPT_INDICATOR { $"(ansi purple) · (ansi reset)" }
136export env PROMPT_INDICATOR_VI_INSERT { $"(ansi purple_reverse) : (ansi reset)" }
137export env PROMPT_INDICATOR_VI_NORMAL { $"(ansi purple_bold) · (ansi reset)" }
138export env PROMPT_MULTILINE_INDICATOR { $"(ansi purple_dimmed)·· (ansi reset)" }
137export env PROMPT_INDICATOR { $"(ansi purple) (char prompt) (ansi reset)" }
138export env PROMPT_INDICATOR_VI_INSERT { $"(ansi purple_reverse) (char pipe) (ansi reset)" }
139export env PROMPT_INDICATOR_VI_NORMAL { $"(ansi purple_bold) (char prompt) (ansi reset)" }
140export env PROMPT_MULTILINE_INDICATOR { $"(ansi purple_dimmed)(char prompt)(char prompt) (ansi reset)" }

nushell/modules/svn.nu

Modified

+1 / −1 text lines

4242 "missing": ( get-item-status-count $svn_status "missing" )
4343 "obstructed": "TODO"
4444 "tree_conflicts": ( $svn_status | get --ignore-errors status.children.target.children.entry.children.wc-status.attributes.tree-conflicted | flatten | flatten | compact | length)
45 "changelists": ( $svn_status | get --ignore-errors status.children.changelist | compact | flatten | get name )
45 "changelists": ( $svn_status | get --ignore-errors status.children.changelist | compact | flatten | get --ignore-errors name )
4646 }

nushell/plugin.nu

Deleted
deleted file mode 100644

+0 / −34 text lines

1register /home/oli/.cargo/bin/nu_plugin_gstat -e json {
2 "name": "gstat",
3 "usage": "Get the git status of a repo",
4 "extra_usage": "",
5 "search_terms": [],
6 "required_positional": [],
7 "optional_positional": [
8 {
9 "name": "path",
10 "desc": "path to repo",
11 "shape": "Filepath",
12 "var_id": null,
13 "default_value": null
14 }
15 ],
16 "rest_positional": null,
17 "named": [
18 {
19 "long": "help",
20 "short": "h",
21 "arg": null,
22 "required": false,
23 "desc": "Display this help message",
24 "var_id": null,
25 "default_value": null
26 }
27 ],
28 "is_filter": false,
29 "creates_scope": false,
30 "category": {
31 "Custom": "Prompt"
32 }
33}

tools/aes.java

Modified

+87 / −62 text lines

11import static java.lang.System.out;
2import static java.nio.file.StandardOpenOption.CREATE_NEW;
3import static java.nio.file.StandardOpenOption.READ;
4import static java.nio.file.StandardOpenOption.WRITE;
36import java.nio.file.*;
47import java.nio.charset.*;
58import java.nio.*;
69import java.io.*;
7import java.util.*;
911import java.security.*;
10import java.security.spec.*;
1213import javax.crypto.*;
1314import javax.crypto.spec.*;
1516class aes {
16 enum Command { ENCRYPT, DECRYPT };
17 enum Command {
18 ENCRYPT, DECRYPT
19 }
1721 static Cipher AES_GCM_PKCS5;
18 static byte[] SALT = new byte[] { 116, 104, 101, 32, 109, 111, 111, 110, 32, 105, 115, 32, 104, 105, 100, 100, 101, 110, 32, 105, 110, 32, 112, 108, 97, 105, 110, 32, 118, 105, 101, 119 };
22 static byte[] SALT = new byte[] { 116, 104, 101, 32, 109, 111, 111, 110, 32, 105, 115, 32, 104, 105, 100, 100, 101,
23 110, 32, 105, 110, 32, 112, 108, 97, 105, 110, 32, 118, 105, 101, 119 };
1924 static SecureRandom RANDOM = new SecureRandom();
2025 /*
2126 * 12 ist NIST recommendation. supposedly fast and secure enough...
2227 */
2328 static int GCM_IV_SIZE = 12;
2429 /*
25 * AES encrypts 128-blocks internally, so this should be reasonable memory bufer size.
30 * AES encrypts 128-blocks internally, so this should be reasonable memory bufer
31 * size.
2632 */
2733 static int READ_BUFFER_SIZE = 128;
2834 /*
29 * Supported sizes for GCM authentication tags seem to be {128, 120, 112, 104, 96}.
30 * But we do not really care, since we do not use them here.
35 * Supported sizes for GCM authentication tags seem to be {128, 120, 112, 104,
36 * 96}.
37 * But we do not really care, since we do not use them here.
3138 */
3239 static int GCM_AUTH_TAG_SIZE = 96;
3441 public static void main(String[] arguments) throws Throwable {
35 if(arguments.length == 0){
42 if (arguments.length == 0) {
3643 usage();
3744 throw fail();
3845 }
4047 var input_command = arguments[0];
4148 Command command;
42 if ("encrypt".startsWith(input_command)) { command = Command.ENCRYPT; }
43 else if ("decrypt".startsWith(input_command)) { command = Command.DECRYPT; }
44 else { throw fail("unknown command %s given%n", emphasize_global(input_command)); }
49 if ("encrypt".startsWith(input_command)) {
50 command = Command.ENCRYPT;
51 } else if ("decrypt".startsWith(input_command)) {
52 command = Command.DECRYPT;
53 } else {
54 throw fail("unknown command %s given%n", emphasize_global(input_command));
55 }
4657 AES_GCM_PKCS5 = Cipher.getInstance("AES/GCM/NoPadding");
4859 var console = System.console();
4960 /*
5061 * If there is no console, this program is most likely part of a pipe.
51 * In such cases a `--password-file` flag is mandatory, because we cannot interactively ask for the password.
62 * In such cases a `--password-file` flag is mandatory, because we cannot
63 * interactively ask for the password.
5264 */
53 if(console == null){
54 if(arguments.length != 3 || !"--password-file".equals(arguments[1])) {
65 if (console == null) {
66 if (arguments.length != 3 || !"--password-file".equals(arguments[1])) {
5567 usage();
56 throw fail("When running %s non-interactively, the %s flag is required.%nOtherwise there is no way to securely obtain the password.%n",emphasize_local("aes"), emphasize_global("--password-file"));
68 throw fail(
69 "When running %s non-interactively, the %s flag is required.%nOtherwise there is no way to securely obtain the password.%n",
70 emphasize_local("aes"), emphasize_global("--password-file"));
5771 }
5872 var password_file = Path.of(arguments[2]);
59 if(!Files.exists(password_file)) { throw fail("the given password file %s does not exist%n", emphasize_local(password_file.toString())); }
73 if (!Files.exists(password_file)) {
74 throw fail("the given password file %s does not exist%n", emphasize_local(password_file.toString()));
75 }
6076 var password = toChars(Files.readAllBytes(password_file));
6177 switch (command) {
6278 case ENCRYPT:
6379 encrypt(password, System.in, System.out);
64 break;
80 break;
6581 case DECRYPT:
6682 decrypt(password, System.in, System.out);
67 break;
83 break;
6884 }
69 }
70 else {
71 if(arguments.length <= 1) {
85 } else {
86 if (arguments.length <= 1) {
7287 usage();
7388 throw fail("not enough arguments given%n");
7489 }
7590 char[] password;
7691 String input;
7792 String output;
78 if("--password-file".equals(arguments[1])) {
79 if(arguments.length != 5) {
93 if ("--password-file".equals(arguments[1])) {
94 if (arguments.length != 5) {
8095 usage();
8196 throw fail("the flag %s requires a path%n", emphasize_local("--password-file"));
8297 }
8398 var password_file = Path.of(arguments[2]);
84 if(!Files.exists(password_file)) { throw fail("the given password file %s does not exist%n", emphasize_local(password_file.toString())); }
99 if (!Files.exists(password_file)) {
100 throw fail("the given password file %s does not exist%n", emphasize_local(password_file.toString()));
101 }
85102 password = toChars(Files.readAllBytes(password_file));
86103 input = arguments[3];
87104 output = arguments[4];
88 }
89 else {
90 if(arguments.length != 3) {
105 } else {
106 if (arguments.length != 3) {
91107 usage();
92108 throw fail("when encrypting/decrypting a file, an output path is required%n");
93109 }
94 password = console.readPassword("[%s]:",emphasize_global("Password"));
110 password = console.readPassword("[%s]:", emphasize_global("Password"));
95111 input = arguments[1];
96112 output = arguments[2];
97113 }
99115 var input_path = Path.of(input);
100 if(!Files.exists(input_path)) { throw fail("the given input path %s does not exist%n", emphasize_global(input_path.toString())); }
116 if (!Files.exists(input_path)) {
117 throw fail("the given input path %s does not exist%n", emphasize_global(input_path.toString()));
118 }
101119 var output_path = Path.of(output);
102 if(Files.exists(output_path)) { throw fail("the output path %s already exists%n", emphasize_global(output_path.toString())); }
120 if (Files.exists(output_path)) {
121 throw fail("the output path %s already exists%n", emphasize_global(output_path.toString()));
122 }
104 var input_stream = Files.newInputStream(input_path, StandardOpenOption.READ);
105 var output_stream = Files.newOutputStream(output_path, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE);
107 switch (command) {
108 case ENCRYPT:
109 encrypt(password, input_stream, output_stream);
110 break;
111 case DECRYPT:
112 decrypt(password, input_stream, output_stream);
113 break;
124 try (var input_stream = Files.newInputStream(input_path, READ);
125 var output_stream = Files.newOutputStream(output_path, CREATE_NEW, WRITE);) {
126 switch (command) {
127 case ENCRYPT:
128 encrypt(password, input_stream, output_stream);
129 break;
130 case DECRYPT:
131 decrypt(password, input_stream, output_stream);
132 break;
133 }
114134 }
115135 }
116136 throw exit();
121141 // in GCM the IV should be unique per encrypted thingy
122142 var initialization_vector = new byte[GCM_IV_SIZE];
123143 RANDOM.nextBytes(initialization_vector);
124 //save the IV for the decryption step later. secure? nope. but how else are we to share IVs between encryption/decryption?
144 // save the IV for the decryption step later. secure? nope. but how else are we
145 // to share IVs between encryption/decryption?
125146 output.write(initialization_vector);
126147 var secret = toSecretKey(password);
127148 var parameter_spec = new GCMParameterSpec(GCM_AUTH_TAG_SIZE, initialization_vector);
130151 var read_buffer = new byte[READ_BUFFER_SIZE];
131152 var aes_buffer = new byte[READ_BUFFER_SIZE];
132153 int read_bytes_count = 0;
133 while((read_bytes_count = input.read(read_buffer)) != -1){
134 var aes_bytes_count = AES_GCM_PKCS5.update(read_buffer, 0, read_bytes_count, aes_buffer);
135 output.write(aes_buffer, 0, aes_bytes_count);
154 while ((read_bytes_count = input.read(read_buffer)) != -1) {
155 var aes_bytes_count = AES_GCM_PKCS5.update(read_buffer, 0, read_bytes_count, aes_buffer);
156 output.write(aes_buffer, 0, aes_bytes_count);
136157 }
137158 output.write(AES_GCM_PKCS5.doFinal());
138159 }
140161 static void decrypt(char[] password, InputStream input, OutputStream output) throws Exception {
141 //the IV get prepended to the data during encryption
162 // the IV get prepended to the data during encryption
142163 var initialization_vector = new byte[GCM_IV_SIZE];
143164 input.read(initialization_vector);
144165 var parameter_spec = new GCMParameterSpec(GCM_AUTH_TAG_SIZE, initialization_vector);
148169 var read_buffer = new byte[READ_BUFFER_SIZE];
149170 var aes_buffer = new byte[READ_BUFFER_SIZE];
150171 int read_bytes_count = 0;
151 while((read_bytes_count = input.read(read_buffer)) != -1){
152 var aes_bytes_count = AES_GCM_PKCS5.update(read_buffer, 0, read_bytes_count, aes_buffer);
153 output.write(aes_buffer, 0, aes_bytes_count);
172 while ((read_bytes_count = input.read(read_buffer)) != -1) {
173 var aes_bytes_count = AES_GCM_PKCS5.update(read_buffer, 0, read_bytes_count, aes_buffer);
174 output.write(aes_buffer, 0, aes_bytes_count);
154175 }
155 // the java impl of GCM seems to buffer the whole data in memory and only releasing it on doFinal. yuck!
176 // the java impl of GCM seems to buffer the whole data in memory and only
177 // releasing it on doFinal. yuck!
156178 // there is not much i can do about this other than to wait for JDK patches.
157 //TODO: in the case of AES GCM the final byte block is the authentication tag.
158 //as such it should porbably NOT be written to the output file.
159 //or is this assumption wrong?
179 // TODO: in the case of AES GCM the final byte block is the authentication tag.
180 // as such it should porbably NOT be written to the output file.
181 // or is this assumption wrong?
160182 output.write(AES_GCM_PKCS5.doFinal());
161 //FIXME: when given a wrong password we get a nonsensical error. make this nicer for human
183 // FIXME: when given a wrong password we get a nonsensical error. make this
184 // nicer for human
162185 }
164187 static SecretKey toSecretKey(char[] password) throws Exception {
165188 var factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
166189 var spec = new PBEKeySpec(password, SALT, 65536, 256);
167 return new SecretKeySpec(factory.generateSecret(spec).getEncoded() , "AES");
190 return new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
168191 }
170193 static char[] toChars(byte[] bytes) {
176199 static void usage() {
177200 out.printf("%s encrypts/decrypts data.%n", emphasize_local("Symmetrically "));
178 out.printf("%s: java aes.java <e(ncrypt)|d(ecrypt)> [--password-file <path>] <input path> <output path>%n", emphasize_global("Usage for files"));
179 out.printf("%s: java aes.java <e(ncrypt)|d(ecrypt)> --password-file <path>%n", emphasize_global("Usage for stdin/stdout"));
201 out.printf("%s: java aes.java <e(ncrypt)|d(ecrypt)> [--password-file <path>] <input path> <output path>%n",
202 emphasize_global("Usage for files"));
203 out.printf("%s: java aes.java <e(ncrypt)|d(ecrypt)> --password-file <path>%n",
204 emphasize_global("Usage for stdin/stdout"));
180205 }
182207 static Throwable exit() {
183208 out.printf("%s!%n", emphasize_local("Done"));
184209 System.exit(0);
185 //abuse control flow to make compiler realize `exit` will never return
186 return new Throwable();
210 // abuse control flow to make compiler realize `exit` will never return
211 return new Throwable();
187212 }
189214 static String emphasize_global(String message) {
197222 static Throwable fail(String message, Object... arguments) {
198223 out.printf(message, arguments);
199224 System.exit(-1);
200 //abuse control flow to make compiler realize `exit` will never return
201 return new Throwable();
225 // abuse control flow to make compiler realize `fail` will never return
226 return new Throwable();
202227 }
204229 static Throwable fail() {
205230 System.exit(-1);
206 //abuse control flow to make compiler realize `exit` will never return
207 return new Throwable();
231 // abuse control flow to make compiler realize `fail` will never return
232 return new Throwable();
208233 }

tools/cargo-tools.nu

Added
new file mode 100644

+59 / −0 text lines

1let cargo_crates = [
2 "sccache"
3 "sd"
4 "cbs"
5 "ouch"
6 "fd-find"
7 "ripgrep"
8 "eva"
9 "mdcat"
10 "hexyl"
11 "hyperfine"
12 "so"
13 "tealdeer"
14 "tokei"
15 "bat"
16 "pastel"
17 "diskonaut"
18 "menyoki"
19 "grex"
20 "xh"
21 "comrak"
22 "bandwhich"
23 "linky"
24 "viu"
25 "licensor"
26 "gib"
27 "silicon"
28 "bottom"
29 "sic"
30]
32let cargo_git_crates = [
33 "https://github.com/mosmeh/indexa"
34]
36def install-helix-editor [] {
37 cd $env.WORKSPACE
38 git clone https://github.com/helix-editor/helix
39 cd helix
40 cargo install --locked --path helix-term
41 hx --grammar fetch
42 hx --grammar build
43}
45def main [] {
46 $cargo_crates | each { |crate|
47 if ( which $crate | empty? ) {
48 cargo install --locked $crate
49 } else {
50 echo $"($crate) already installed"
51 }
52 }
53
54 $cargo_git_crates | each { |crate|
55 cargo install --locked --git $crate
56 }
57
58 install-helix-editor
59}

tools/cargo_tools.nu

Deleted
deleted file mode 100644

+0 / −49 text lines

1let cargo_crates = [
2 "sd"
3 "fd-find"
4 "ripgrep"
5 "eva"
6 "watchexec-cli"
7 "mdcat"
8 "hexyl"
9 "hyperfine"
10 "so"
11 "tealdeer"
12 "tokei"
13 "bottom"
14 "bat"
15 "pastel"
16 "diskonaut"
17 "menyoki"
18 "rpick"
19 "grex"
20 "xh"
21 "comrak"
22 "bandwhich"
23 "linky"
24 "viu"
25 "licensor"
26 "gib"
27 "silicon"
28 "onefetch"
29]
31let cargo_git_crates = [
32 "https://github.com/mosmeh/indexa"
33]
35def install_hx [] {
36 cd $env.WORKSPACE
37 git clone https://github.com/helix-editor/helix
38 cd helix
39 cargo install --path helix-term
40 hx --grammar fetch
41 hx --grammar build
42}
44def main [] {
45 cargo install --locked $cargo_crates
46 cargo install --locked nu --all-features
47 $cargo_git_crates | each {|it| cargo install --locked --git $it }
48 install_hx
49}

tools/nerd-font.sh

Added
new file mode 100644

+55 / −0 text lines

1#!/bin/bash
2
3# rewrite this some time...
4
5declare -a fonts=(
6 3270
7 Agave
8 AnonymousPro
9 Arimo
10 ArulentSansMono
11 BigBlueTerminal
12 BitstreamVeraSansMono
13 CascadiaCode
14 CodeNewRoman
15 DroidSansMono
16 FiraCode
17 FiraMono
18 Gohu
19 Go-Mono
20 Hack
21 Hasklig
22 Hermit
23 IBMPlexMono
24 iA-Writer
25 Iosevka
26 JetBrainsMono
27 Meslo
28 Overpass
29 ProggyClean
30 RobotoMono
31 SourceCodePro
32 SpaceMono
33 Ubuntu
34 UbuntuMono
35)
37version='2.1.0'
38fonts_dir="${HOME}/.local/share/fonts"
40if [[ ! -d "$fonts_dir" ]]; then
41 mkdir -p "$fonts_dir"
42fi
44for font in "${fonts[@]}"; do
45 zip_file="${font}.zip"
46 download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
47 echo "Downloading $download_url"
48 wget "$download_url"
49 unzip "$zip_file" -d "$fonts_dir"
50 rm "$zip_file"
51done
53find "$fonts_dir" -name '*Windows Compatible*' -delete
55fc-cache -fv

tools/nerd_font.sh

Deleted
deleted file mode 100755

+0 / −55 text lines

1#!/bin/bash
2
3# rewrite this some time...
4
5declare -a fonts=(
6 3270
7 Agave
8 AnonymousPro
9 Arimo
10 ArulentSansMono
11 BigBlueTerminal
12 BitstreamVeraSansMono
13 CascadiaCode
14 CodeNewRoman
15 DroidSansMono
16 FiraCode
17 FiraMono
18 Gohu
19 Go-Mono
20 Hack
21 Hasklig
22 Hermit
23 IBMPlexMono
24 iA-Writer
25 Iosevka
26 JetBrainsMono
27 Meslo
28 Overpass
29 ProggyClean
30 RobotoMono
31 SourceCodePro
32 SpaceMono
33 Ubuntu
34 UbuntuMono
35)
37version='2.1.0'
38fonts_dir="${HOME}/.local/share/fonts"
40if [[ ! -d "$fonts_dir" ]]; then
41 mkdir -p "$fonts_dir"
42fi
44for font in "${fonts[@]}"; do
45 zip_file="${font}.zip"
46 download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
47 echo "Downloading $download_url"
48 wget "$download_url"
49 unzip "$zip_file" -d "$fonts_dir"
50 rm "$zip_file"
51done
53find "$fonts_dir" -name '*Windows Compatible*' -delete
55fc-cache -fv

topgrade/topgrade.windows.toml

Modified

+13 / −8 text lines

11# Disable specific steps - same options as the command line flag
2disable = ["tldr"]
2disable = ["wsl", "tldr"]
44assume_yes = true
1818[git]
1919# Additional git repositories to pull
20repos = ["W:/misc/*/"]
20repos = ["W:/misc/*/", "W:/*/"]
2222max_concurrency = 12
2626# Arguments to pass Git when pulling Repositories
2727arguments = "--ff --rebase --autostash"
29[windows]
30enable_winget = true
2932# Commands to run before anything
3033#[pre_commands]
3134#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
3336# Custom commands
3437[commands]
35"Refresh dotfiles" = "java W:/misc/dotfiles/bootstripper.java W:/misc/dotfiles"
38"00 - Refresh dotfiles" = "java W:/dotfiles/bootstripper.java W:/dotfiles"
37# Leider scheint der eingebaute "tldr" step von topgrade nicht für meine Version von TLDR funktionieren
38"TLDR" = "tldr --update"
40"01 - Install Cargo Tools" = "nu W:/dotfiles/tools/cargo-tools.nu"
4042# Diese Skripte beziehen APM und MeMate aus dem Transfer.
41"Advantage-PM Client" = ". D:/Tools/update_apm_client.ps1"
42"MeMate" = ". D:/Tools/update_memate.ps1"
43"02 - Advantage-PM Client" = "nu X:/update_apm_client.nu"
44"03 - MeMate" = "nu X:/update_memate.nu"
4446# Dateisystem-Indexer ix erfrischen
45"Indexa Update" = "ix --update"
47"04 - Indexa Update" = "ix --update"
49# Leider scheint der eingebaute "tldr" step von topgrade nicht für meine Version von TLDR funktionieren
50"05 - TLDR" = "tldr --update"No final newline