Compare commits

...

7 Commits

Author SHA1 Message Date
2053483224 nu: init autoload files
These might be better as part of the configuration but I find these to
be easier to setup for modular configurations.
2025-01-21 21:15:44 +08:00
be96d5bdce nvim: update lazy packages 2025-01-19 23:33:21 +08:00
18c342660c nvim: update Lush colors template 2025-01-19 23:33:11 +08:00
9bd879c61a emacs: update wiki Doom module 2024-12-29 12:19:26 +08:00
b9b0532e6d bin/fds-passsuite: add more subcommands 2024-12-29 12:18:03 +08:00
f3edaf41e1 bin/create-mxroute-email-accts: init 2024-10-19 10:19:48 +08:00
f89e2962dc bin/fds-passsuite: init 2024-10-14 17:54:24 +08:00
9 changed files with 223 additions and 53 deletions

59
bin/create-mxroute-email-accts Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.requests
import os
import requests
import csv
import time
import json
import subprocess
import sys
# This is a modified script from
# <https://gist.github.com/Suleman-Elahi/f6c00a986ea80f8fe58e20df28c97ca9>
# allowing to generate passwords through a command and some polish on the code.
#
# The biggest difference is it is configured through the environment variables
# rather than modifying the script.
#
# Anyways, as of 2024-09-16, MXRoute uses DirectAdmin and it does have an API
# at <https://www.directadmin.com/api.html>. Just create your own script around
# its REST API for this like you always do.
prefix = "MXROUTE_SERVER"
server_login = os.environ[f"{prefix}_NAME"]
server_pass = os.environ[f"{prefix}_LOGIN_KEY"]
server_endpoint_url = os.environ[f"{prefix}_URL"] + "/CMD_API_EMAIL_POP"
pwgen_command = os.environ[f"{prefix}_PASSCOMMAND"] or "generate-password"
template = {
"json": "yes",
"action": "create",
"limit": "7200",
}
with open(sys.argv[1], newline="\n") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
data = dict(template)
data["user"] = row["email"].split("@")[0].lower()
data["quota"] = row["quota"]
data["domain"] = row["email"].split("@")[1].lower()
print(data, server_endpoint_url)
password = subprocess.run(
pwgen_command, stdout=subprocess.PIPE, check=True, shell=True
).stdout
data["passwd2"] = str(password)
data["passwd"] = str(password)
response = requests.post(
server_endpoint_url,
headers={"Content-Type": "application/x-www-form-urlencoded"},
auth=(server_login, server_pass),
data=json.dumps(data),
timeout=5,
)
print("Status: ", response.status_code, " User ", data["user"], " created !!")
# Sleeping to slow down the request.
time.sleep(2)

28
bin/fds-passsuite Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env ysh
proc main(...args) {
var subcommand = args[0]
shift 1
case (subcommand) {
passphrase {
gopass pwgen --xkcd --lang en --one-per-line --xkcdnumbers --xkcdcapitalize @[args] | head -n1
}
password {
gopass pwgen --symbols --one-per-line @[args] | head -n1
}
secret {
dd if=/dev/urandom bs=32 count=1 2>/dev/null | base64
}
encode-argon2 {
write -- $[args[1]] | argon2 $(openssl rand -base64 32) -e -id -k 65540 -t 3 -p 4
}
(else) {
echo "Invalid subcommand: '$[arg1]'." 1>&2
exit 1
}
}
}
if is-main {
main @ARGV
}

View File

@ -58,11 +58,6 @@ folder with its buffer filename."
;; Overriding some of the options. Unfortunately, some of them have to be
;; overridden after org-roam has been loaded.
(with-eval-after-load "org-roam"
(setq org-roam-node-display-template
(format "${doom-hierarchy:*} %s %s"
(propertize "${doom-tags:15}" 'face 'org-tag)
(propertize "${file:60}" 'face 'font-lock-default-face)))
(cl-defmethod org-roam-node-slug :around ((node org-roam-node))
(string-replace "_" "-" (cl-call-next-method))))
@ -88,10 +83,6 @@ folder with its buffer filename."
org-startup-with-inline-images t
image-use-external-converter t)
;; Add extra org-modules for our default Org-mode workflow.
(add-to-list 'org-modules 'org-habit)
(add-to-list 'org-modules 'org-checklist)
;; Automate updating timestamps on save.
(add-hook! 'before-save-hook 'time-stamp))

63
nu/autoload/fzf.nu Normal file
View File

@ -0,0 +1,63 @@
# Nushell module based from the `fzf --bash` output.
#
# This port takes some liberty from the Bash script and does not have the same
# integrations such as tmux for now.
#
# It accepts the following envvars and their following description:
#
# - FZF_TMUX_HEIGHT should be the height of the prompt interface and mainly
# used in considering for opening inside of tmux env.
# - FZF_CTRL_T_COMMAND is the default command for Ctrl+T keybinding set for
# this Nu script.
# - FZF_DEFAULT_OPTS is a string
let __fzf_defaults = [
--height ($env.FZF_TMUX_HEIGHT? | default "40%")
--bind=ctrl-z:ignore
]
def __fzf_select [...flags: string] {
with-env {
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS? | default $__fzf_defaults)
} {
fzf ...$flags ...$env.FZF_DEFAULT_OPTS
}
}
def __fzf_cd [...flags: string] {
with-env {
FZF_CTRL_T_COMMAND: ($env.FZF_CTRL_T_COMMAND? | default "fzf")
FZF_DEFAULT_OPTS: ($env.FZF_DEFAULT_OPTS? | default $__fzf_defaults)
} {
fzf ...$env.FZF_DEFAULT_OPTS --reverse --walker=dir,hidden,follow ...$flags
}
}
$env.config.keybindings = $env.config.keybindings | append [
{
name: fzf_select
modifier: control
keycode: char_t
mode: [emacs vi_normal vi_insert]
event: {
send: ExecuteHostCommand
cmd: "commandline edit --insert (
__fzf_select '--multi'
| lines
| str join ' '
)"
}
}
{
name: fzf_cd
modifier: alt
keycode: char_c
mode: [emacs vi_normal vi_insert]
event: {
send: ExecuteHostCommand
cmd: "cd (__fzf_cd)"
}
}
]

34
nu/autoload/qol.nu Normal file
View File

@ -0,0 +1,34 @@
$env.config.menus = $env.config.menus | append [
{
name: vars_menu
only_buffer_difference: true
marker: "var "
type: {
layout: list
page_size: 10
}
style: {
text: green
selected_text: green_reverse
description_text: yellow
}
source: { |buffer, position|
scope variables
| where name =~ $buffer
| sort-by name
| each { |row| {value: $row.name description: $row.type} }
}
}
]
$env.config.keybindings = $env.config.keybindings | append [
{
name: vars_menu
modifier: control
keycode: char_u
mode: [emacs vi_normal vi_insert]
event: {
send: menu name: vars_menu
}
}
]

8
nu/autoload/wezterm.nu Normal file
View File

@ -0,0 +1,8 @@
$env.config = $env.config | merge deep --strategy=append {
show_banner: false
shell_integration: {
osc7: true
osc133: true
osc633: true
}
}

View File

@ -2,19 +2,5 @@
set background=dark
let g:colors_name="fds-theme"
" By setting our module to nil, we clear lua's cache,
" which means the require ahead will *always* occur.
"
" This isn't strictly required but it can be a useful trick if you are
" incrementally editing your config a lot and want to be sure your themes
" changes are being picked up without restarting neovim.
"
" Note if you're working in on your theme and have :Lushify'd the buffer,
" your changes will be applied with our without the following line.
"
" The performance impact of this call can be measured in the hundreds of
" *nanoseconds* and such could be considered "production safe".
lua package.loaded['lush_theme.fds-theme'] = nil
" include our theme file and pass it to lush to apply
lua require('lush')(require('lush_theme.fds-theme'))

View File

@ -1,29 +1,29 @@
{
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"ale": { "branch": "master", "commit": "9a23ec1f60ec85f6afb70870a1978141b321fb3c" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"ale": { "branch": "master", "commit": "6c337ad19ca32fcb11ff7f29a8e68598763b59a2" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" },
"editorconfig-vim": { "branch": "master", "commit": "95cb75e21d11206dad4bd3895c99459bdaa13dd1" },
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lush.nvim": { "branch": "main", "commit": "e8a58f36c256af65cda36878f6f2024a612154c3" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" },
"nvim-lspconfig": { "branch": "master", "commit": "e47ccfae775f0d572ef0f3a7d245f043b259dafc" },
"nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "a97a6ea140cbe5e0f7ab1291c7ca70abd5171d31" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope.nvim": { "branch": "master", "commit": "da8b3d485975a8727bea127518b65c980521ae22" },
"vim-airline": { "branch": "master", "commit": "ff7352e4bff02eb600a136b6fd741404f3195371" },
"vim-gitgutter": { "branch": "main", "commit": "67ef116100b40f9ca128196504a2e0bc0a2753b0" },
"vim-nix": { "branch": "master", "commit": "048c71f1ed2c679cd55acd2c807c2c96aea82e65" },
"vimspector": { "branch": "master", "commit": "703df4d948957105fe056dec9b106fbebf25ca66" },
"zig.vim": { "branch": "master", "commit": "54c216e5306a5c3878a60596aacb94dca8652ab9" }
}
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"dhall-vim": { "branch": "master", "commit": "bd9fd99f21dbc7174fb728a21d04e073ef7dd930" },
"editorconfig-vim": { "branch": "master", "commit": "3c2813f2566d9392ff3614248c5db43c3fda9d5f" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"lush.nvim": { "branch": "main", "commit": "45a79ec4acb5af783a6a29673a999ce37f00497e" },
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" },
"nvim-lspconfig": { "branch": "master", "commit": "14b5a806c928390fac9ff4a5630d20eb902afad8" },
"nvim-treesitter": { "branch": "master", "commit": "4423f3053964461656c7432fd33f205ef88a6168" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
"vim-airline": { "branch": "master", "commit": "7a552f415c48aed33bf7eaa3c50e78504d417913" },
"vim-gitgutter": { "branch": "main", "commit": "7b0b5098e3e57be86bb96cfbf2b8902381eef57c" },
"vim-nix": { "branch": "master", "commit": "e25cd0f2e5922f1f4d3cd969f92e35a9a327ffb0" },
"vimspector": { "branch": "master", "commit": "5e24df822e278ee79abfc8c7110089a5322d1a3c" },
"zig.vim": { "branch": "master", "commit": "f023e86b042c0d5bef68b9f0651144a6bf6d642e" }
}

View File

@ -41,8 +41,8 @@ local base0F = hsl("#7f3F83")
--[[
Define additional colors if defined in the theme. Fallback to base00 - base07
if not defined.
Define additional colors if defined in the theme. Fallback to base00 - base07
if not defined.
]]
@ -65,6 +65,7 @@ vim.g.terminal_color_15 = base07.hex
vim.g.terminal_color_background = base00.hex
vim.g.terminal_color_foreground = base0E.hex
-- @diagnostic disable: undefined-global
return lush(function()
return {
Normal({ fg = base05, bg = base00 }),
@ -301,10 +302,10 @@ return lush(function()
sassMixinName({ fg = base0D }),
-- Spelling highlighting
SpellBad({ gui = "undercurl" }), --, base08)
SpellBad({ gui = "undercurl" }), --, base08)
SpellLocal({ gui = "undercurl" }), --, base0C)
SpellCap({ gui = "undercurl" }), --, base0D)
SpellRare({ gui = "undercurl" }), --, base0E)
SpellCap({ gui = "undercurl" }), --, base0D)
SpellRare({ gui = "undercurl" }), --, base0E)
-- Startify highlighting
StartifyBracket({ fg = base03 }),