regular backup

This commit is contained in:
arielherself 2024-09-02 21:10:02 +08:00
parent fb7b811b82
commit 7b4fe8e93c
Signed by: arielherself
SSH Key Fingerprint: SHA256:AK3cyo9tFsp7Mox7K0sYphleC8hReXhnRKxwuDT5LBc
7 changed files with 164 additions and 12 deletions

View File

@ -7,8 +7,8 @@ let
mypkgs = import (pkgs.fetchFromGitHub {
owner = "arielherself";
repo = "mypkgs";
rev = "75f9b72";
hash = "sha256-vlfIPxOJ/wxlpLrOIUrxISzysFZ+kZ2nE/ELU2IaJqg=";
rev = "dc9d9be";
hash = "sha256-+SdZ8H4qAcLG6baYb1WU/Sd1Dgh2eo/DHmi2Ig7NAnI=";
});
in {
nixpkgs.config.allowUnfree = true;
@ -132,9 +132,9 @@ in {
pkgs.clang-tools
pkgs.lua-language-server
pkgs.cmake-language-server
pkgs.nil # Nix language server
pkgs.nil # Nix language server
pkgs.nodePackages.typescript-language-server
pkgs.nodePackages.vls # Vue language server
pkgs.nodePackages.vls # Vue language server
pkgs.nodePackages.prettier
unstable.markdown-oxide
pkgs.helix
@ -152,20 +152,19 @@ in {
pkgs.autoconf
pkgs.automake
pkgs.btop
pkgs.fx
pkgs.fx # JSON pager
pkgs.mtr
pkgs.htop
pkgs.gdb
pkgs.dropbox
pkgs.brightnessctl
pkgs.psmisc
pkgs.xclip # Clipboard support
pkgs.xclip # Clipboard support
pkgs.vulkan-tools
pkgs.lshw
pkgs.lshw # Hardware info
unstable._1password
unstable._1password-gui
pkgs.nix-index
pkgs.dua
pkgs.rclone
# Pwn
@ -189,6 +188,7 @@ in {
# Desktop management
pkgs.xfce.thunar
pkgs.baobab
pkgs.dua # CLI disk usage
pkgs.i3lock
pkgs.flameshot
@ -198,7 +198,7 @@ in {
pkgs.sioyek
# Multimedia
pkgs.kdePackages.gwenview
pkgs.kdePackages.gwenview # Image viewer
pkgs.vlc
pkgs.playerctl
pkgs.ffmpeg
@ -212,6 +212,11 @@ in {
pkgs.telegram-desktop
pkgs.discord
# Browser
pkgs.firefox-devedition
pkgs.chromium
mypkgs.thorium
# Misc
pkgs.fastfetch
pkgs.onefetch
@ -228,8 +233,6 @@ in {
unstable.adwaita-icon-theme
pkgs.adwaita-qt
pkgs.adwaita-qt6
pkgs.firefox-devedition
mypkgs.thorium
pkgs.wiki-tui
pkgs.asciiquarium # Interesting
pkgs.starship # Prompt bar

View File

@ -167,6 +167,7 @@ in {
"wheel"
"wireshark"
"vboxusers"
"networkmanager"
]; # Enable sudo for the user.
packages = with pkgs; [
home-manager
@ -218,6 +219,8 @@ in {
programs.dconf.enable = true;
programs.nix-ld.enable = true;
# List services that you want to enable:
# Enable the OpenSSH daemon.

View File

@ -484,6 +484,7 @@ local plugins = {
end
},
{ 'NStefan002/screenkey.nvim' },
{ 'kosayoda/nvim-lightbulb' },
}
require("lazy").setup(plugins, {})
@ -1175,3 +1176,7 @@ require("telescope").setup {
require('mini.trailspace').setup {}
require('lsp_lines').setup {}
require("nvim-lightbulb").setup {
autocmd = { enabled = true }
}

51
nvim/lua/snippets/fft.lua Normal file
View File

@ -0,0 +1,51 @@
return [=[
void fft(vector<complex<ld>>& y, bool idft) {
int n = y.size();
vector<int> rev(n);
for (int i = 0; i < n; ++i) {
rev[i] = rev[i >> 1] >> 1;
if (i & 1) {
rev[i] |= n >> 1;
}
}
for (int i = 0; i < n; ++i) {
if (i < rev[i]) {
swap(y[i], y[rev[i]]);
}
}
for (int h = 2; h <= n; h <<= 1) {
complex<ld> wn(cos(2 * M_PI / h), sin(2 * M_PI / h));
for (int j = 0; j < n; j += h) {
complex<ld> w(1);
for (int k = j; k < j + h / 2; ++k) {
complex<ld> u = y[k], t = w * y[k + h / 2];
y[k] = u + t;
y[k + h / 2] = u - t;
w *= wn;
}
}
}
if (idft) {
reverse(y.begin() + 1, y.end());
for (int i = 0; i < n; ++i) {
y[i] /= n;
}
}
}
vector<int> multiply(const vector<int>& a, const vector<int>& b) {
vector<complex<ld>> A(a.begin(), a.end()), B(b.begin(), b.end());
int n = 1;
while (n < a.size() + b.size()) n <<= 1;
A.resize(n), B.resize(n);
fft(A, false), fft(B, false);
for (int i = 0; i < n; ++i) {
A[i] *= B[i];
}
fft(A, true);
vector<int> res(n);
transform(A.begin(), A.end(), res.begin(), expr(int(round(x.real())), auto&& x));
return res;
}
]=]

View File

@ -300,3 +300,29 @@ ls.add_snippets(nil, {
})
}
})
local fft = require('snippets.fft')
ls.add_snippets(nil, {
cpp = {
snip({
trig = 'fft',
namr = 'fft',
dscr = 'FFT',
},{
text(lines(fft))
})
}
})
local ntt = require('snippets.ntt')
ls.add_snippets(nil, {
cpp = {
snip({
trig = 'ntt',
namr = 'ntt',
dscr = 'NTT',
},{
text(lines(ntt))
})
}
})

64
nvim/lua/snippets/ntt.lua Normal file
View File

@ -0,0 +1,64 @@
return [=[
template <ll M>
void ntt(vector<MLL<M>>& y, bool idft) {
using mll = MLL<M>;
int n = y.size();
vector<int> rev(n);
for (int i = 0; i < n; ++i) {
rev[i] = rev[i >> 1] >> 1;
if (i & 1) {
rev[i] |= n >> 1;
}
}
for (int i = 0; i < n; ++i) {
if (i < rev[i]) {
swap(y[i], y[rev[i]]);
}
}
vector<mll> roots = { 0, 1 };
if (roots.size() < n) {
int k = lsp(roots.size());
roots.resize(n);
for (; (1 << k) < n; ++k) {
mll e = qpow<mll>(31, 1 << lsp(M - 1) - k - 1);
for (int i = 1 << k - 1; i < (1 << k); ++i) {
roots[2 * i] = roots[i];
roots[2 * i + 1] = roots[i] * e;
}
}
}
for (int h = 2; h <= n; h <<= 1) {
for (int j = 0; j < n; j += h) {
for (int k = j; k < j + h / 2; ++k) {
mll u = y[k], t = roots[k - j + h / 2] * y[k + h / 2];
y[k] = u + t;
y[k + h / 2] = u - t;
}
}
}
if (idft) {
reverse(y.begin() + 1, y.end());
for (int i = 0; i < n; ++i) {
y[i] /= n;
}
}
}
template <ll M>
vector<MLL<M>> multiply(const vector<MLL<M>>& a, const vector<MLL<M>>& b) {
using mll = MLL<M>;
vector<mll> A(a.begin(), a.end()), B(b.begin(), b.end());
int n = 1;
while (n < a.size() + b.size()) n <<= 1;
A.resize(n), B.resize(n);
ntt<M>(A, false), ntt<M>(B, false);
for (int i = 0; i < n; ++i) {
A[i] *= B[i];
}
ntt<M>(A, true);
return A;
}
]=]

View File

@ -59,7 +59,7 @@
<property name="disableAudio" value="false"/>
<!--Hides scroolbars in the main window, allowed values: "none", "horizontal", "vertical", "both"-->
<property name="scrollbarHideType" value="none"/>
<property name="autoloadMostRecent" value="true"/>
<property name="autoloadMostRecent" value="false"/>
<property name="autoloadPdfXoj" value="true"/>
<property name="defaultSaveName" value="%F-Note-%H-%M"/>
<property name="defaultPdfExportName" value="%{name}_annotated"/>