diff --git a/globurrl.nim b/globurrl.nim index 73d6698..e1a142b 100644 --- a/globurrl.nim +++ b/globurrl.nim @@ -125,14 +125,6 @@ proc debugLog*(str: string) = defer: f.close() f.writeLine(str) -proc switchTwmMode*(mode: string = "default") = - # I intend to add support for more twm as time goes on (I switch around a lot) - # Switch out of an i3 bindsym mode if set - if wayland: - discard execCmd("sway mode \"" & mode & "\"") - else: - discard execCmd("i3-msg mode \"" & mode & "\"") - proc checkWayland() = if getEnv("XDG_SESSION_TYPE") == "wayland": wayland = true @@ -264,10 +256,6 @@ proc checkCacheDir() = # At Start up: checkCacheDir() -checkWayland() - -# Switch bindsym mode back to default as it could be being used. -switchTwmMode() let args* = getArguments() diff --git a/pw_generaturr/nim.cfg b/pw_generaturr/nim.cfg new file mode 100644 index 0000000..521e21d --- /dev/null +++ b/pw_generaturr/nim.cfg @@ -0,0 +1 @@ +-d:ssl diff --git a/pw_generaturr/src/pw_generaturr.nim b/pw_generaturr/src/pw_generaturr.nim index 41f95f3..e6c220c 100644 --- a/pw_generaturr/src/pw_generaturr.nim +++ b/pw_generaturr/src/pw_generaturr.nim @@ -2,13 +2,33 @@ import ../../globurrl import httpclient import json +import strutils +import random +var length = 4 + +proc getNumber(size: int = 4): string = + var num = "" + for _ in countup(1,size): + randomize() + let roll = rand(0..9) + num &= $roll + return num + +proc parsePw(body: string) = + let j = body.parseJson + for pass in j.getElems: + var p = pass.getStr.capitalizeAscii + p &= getNumber(length) + echo p + + proc getPW() = var c = newHttpClient() try: let resp = c.get("https://random-word-api.herokuapp.com/word?length=5") if resp.status == $Http200: - echo resp.body.parseJson + parsePw(resp.body) except: echo getCurrentExceptionMsg()