repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

cross platform java tools

6d6e1f3bf9b655934248a09c45139eb2c8edd3e4

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

unsigned

Browse filesCompare with HEAD

Changed files (3)

alacritty/alacritty.yml

Modified
3 3 # Windows configuration for alacritty
4 4 # Import common configuration for all platforms.
5 5 # Subsequent configuration in this file will overwrite the common configuration.
6 6 import:
7 7 - ~/.config/alacritty/alacritty_common.yml
8 -window:
9 - startup_mode: Fullscreen
10 8 # Font configuration (changes require restart)
11 9 font:
12 10 normal:

nushell/nu/config/nurc

Modified
5 5 # GLOBAL VARIABLES
6 6 let TODO_FILE = D:/Notizen/TODO.md
7 7 let NURC = (build-string (config path | path dirname) /nurc)
8 +let OS = (sys).host.name
9 10 # ALIASES
10 11 alias cat = bat
15 16 alias grep = rg
17 18 # CUSTOM LITTLE JAVA COMMANDS
18 -alias sha = java X:/tools/sha.java
19 -alias uuid = java X:/tools/random_uuid.java
20 -alias download = java X:/tools/download.java
21 -alias download_jar = java X:/tools/download_jar.java
22 -alias file = java X:/tools/probe_content.java
19 +alias sha = java_tool sha
20 +alias uuid = java_tool random_uuid
21 +alias download = java_tool download
22 +alias download_jar = java_tool download_jar
24 24 # FUNCTIONS
26 +# Wrapper function to launch my custom java tool scripts.
27 +# This function handles the different paths the tools can have on different hosts.
28 +def java_tool [
29 + name: string # name of the custom java tool script without the .java extension
30 +] {
31 + # the paths are assumed to have already been linked from dotfiles
32 + if $OS == "Windows" {
33 + java (build-string X:/tools/ $name .java)
34 + } {
35 + java (build-string ~/.local/tools/ $name .java)
36 + }
26 39 def man [
27 40 program: string
29 - if (sys).host.name == "Windows" {
42 + if $OS == "Windows" {
30 43 start (build-string https://man.cx/ $program)
32 - exec man
45 + exec man $program

tools/startup.java

Deleted
deleted file mode 100644
1 -import static java.lang.System.out;
2 -import static java.nio.charset.StandardCharsets.UTF_16LE;
3 -import static java.util.stream.Collectors.joining;
5 -import java.util.*;
7 -class startup {
8 - public static void main(String[] __) throws Exception {
9 - out.println("Map D:/Workspaces to W:.");
10 - call("subst.exe", "W:", "D:\\Workspaces");
11 - out.println("Map D:/Notizen to N:.");
12 - call("subst.exe", "N:", "D:\\Notizen");
13 - out.println("Map D:/Tools to X:.");
14 - call("subst.exe", "X:", "D:\\Tools");
15 - out.println("save list of installed apps in case something goes wrong and mass reinstall is necessary.");
16 - ps("scoop export > D:\\Tools\\scoop_installed_apps.txt");
17 - ps("winget export D:\\Tools\\winget_installed_apps.json");
18 - out.println("Upgrading the whole system.");
19 - ps("topgrade");
20 - pause();
21 - }
23 - static int call(String... command) throws Exception {
24 - return new ProcessBuilder()
25 - .command(command)
26 - .inheritIO()
27 - .start()
28 - .onExit()
29 - .join()
30 - .exitValue();
31 - }
33 - static int ps(String command) throws Exception {
34 - return call(
35 - "powershell.exe",
36 - "-NonInteractive",
37 - "-NoProfile",
38 - "-NoLogo",
39 - "-encodedCommand",
40 - Base64.getEncoder().encodeToString(command.getBytes(UTF_16LE)));
41 - }
43 - static void pause() throws Exception {
44 - out.println("pause; waiting for input...");
45 - System.in.read();
46 - }
47 -}