fresh start

This commit is contained in:
Misha 2025-04-06 17:43:59 +02:00
commit d4a15605b1
121 changed files with 20389 additions and 0 deletions
.gitignoreREADME.orgconfiguration.nixflake.lockflake.nixhome.nixhost1.nix
img
ireneco.nixmisha.nixml1.nix
other-config

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
*~
other-config/mail/__pycache__/
TOKEN_FILENAME
.#*
#*#
secrets/secrets.nix
refresh_token

69
README.org Normal file
View file

@ -0,0 +1,69 @@
#+OPTIONS: toc:nil
* Intro
- This set-up closely follows the tutorial by [[https://chattingdarkly.org/@chrism][Chris McDonough]].
- [[https://github.com/mcdonc/.nixconfig/blob/master/videos/peruserperhost/script.rst][Tutorial 1]]
- [[https://github.com/mcdonc/.nixconfig/blob/master/videos/peruserperhost2/script.rst][Tutorial 2]]
- [[https://github.com/mcdonc/.nixconfig/blob/master/videos/peruserperhost3/script.rst][Tutorial 3]]
- It's a work in progress. Still very much learning about Nix and NixOS.
#+ATTR_HTML: :width 350
[[./img/chris-setup.jpg]]
* Emacs set-up
- This [[./other-config/emacs/README.org][set-up]] depends heavily on the amazing work of [[https://github.com/dalanicolai][Daniel Nicolai]].
* Notes for self
** Initialization
- Add vimHugeX for clipboard support
- Add git to clone repo
** Nextcloud (untested)
- Sync "nixos" Nextcloud folder
- ~sudo nixos-rebuild switch~
- Add ssh keys to git.pub.solar to be able to push changes
- ~ssh-keygen -t ecdsa -b 521~
** git.pub.solar
- Create ssh keys:
- ~ssh-keygen -t ecdsa -b 521~
- Log in: https://git.pub.solar/misha/nixos-multihost
- Add and verify keys
- Clone repo
** Old and new nixos
- Move newly created nixos to home folder
- Move cloned/synced nixos to /etc/nixos
** If necessary: add new host
- Rename newly created hardware-configuration with name of new host, let's say ml1.nix, and add this to new nixos folder.
- Add the imports of configuration.nix and the users for ml1 to this ml1.nix.
#+begin_src nix
imports =
[
./misha.nix #<- this
./configuration.nix #<- and this
(modulesPath + "/installer/scan/not-detected.nix") #<- not necessarily this
];
#+end_src
- Copy the bootlader lines up to and including networking.hostName from the newly created configuration.nix to the ml1.nix
#+begin_src nix
#----------------
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices."luks-75fbd436-3b4f-4912-b852-0f7be90995a9".device = "/dev/disk/by-uuid/75fbd436-3b4f-4912-b852-0f7be90995a9";
networking.hostName = "ml1"; # Define your hostname.
#----------------
#+end_src
- Add the new host to flake.nix.
#+begin_src nix
ml1 = nixpkgs.lib.nixosSystem {
specialArgs = specialArgs;
system = system;
modules = shared-modules ++ [ ./ml1.nix];
#+end_src
** TODO List
- [ ] Create an ISO image with vimHugeX and git
- [ ] Test VimHugeX clipboard support in new host
- [ ] Test Nextcloud sync to get git repo

418
configuration.nix Normal file
View file

@ -0,0 +1,418 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running 'nixos-help').
{ config, pkgs, ... }:
{
nixpkgs.overlays = [
(final: prev: {
emacs = prev.emacs.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(final.fetchpatch {
url = "https://git.savannah.gnu.org/cgit/emacs.git/patch/?id=53a5dada413662389a17c551a00d215e51f5049f";
hash = "sha256-AEvsQfpdR18z6VroJkWoC3sBoApIYQQgeF/P2DprPQ8=";
})
];
});
})
];
nix = {
settings = {
experimental-features = "nix-command flakes";
};
};
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
#i18n.defaultLocale = "nl_NL.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8";
};
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# #----- networkmanager ---- start
# # Enable networking
# networking.networkmanager.enable = true;
# #----- networkmanager ---- end
# This is for password management
age.identityPaths = [ "/home/misha/.ssh/id_ed25519" ]; # This was necessary for some reason.
age.secrets.secret1.file = ./secrets/secret1.age;
#----- wpa_supplicant ---- start
networking.networkmanager.enable = false;
networking.wireless = {
secretsFile = "/run/agenix/secret1";
enable = true;
userControlled.enable = true;
networks = {
"eduroam" = {
hidden = true;
priority = 2;
auth = ''
key_mgmt=WPA-EAP
eap=TTLS
identity="mvelthu@uva.nl"
password=ext:eduroam_password
anonymous_identity="anonymous@uva.nl"
phase2="auth=PAP"
'';
};
"De Waaghals" = {
pskRaw = ext:wifi_home;
};
"michiel_de_router" = {
pskRaw = ext:wifi_kerkelaan;
};
# "Coffeecompany" = {
# priority = 3;
# psk = "sinds1996";
# };
"Hello" = {
priority=4;
pskRaw = ext:phone;
};
# Coffeecompany Oosterdok
"Coffeecompany" = {
auth = ''
key_mgmt=NONE
'';
};
};
};
#----- wpa_supplicant ---- end
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
#time.timeZone = "America/Bogota";
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# MV I could not get the wifi printer working
# https://discourse.nixos.org/t/printers-they-work/17545/2
services.printing.browsing = true;
services.printing.browsedConf = ''
BrowseDNSSDSubTypes _cups,_print
BrowseLocalProtocols all
BrowseRemoteProtocols all
CreateIPPPrinterQueues All
BrowseProtocols all
'';
services.avahi = {
enable = true;
nssmdns = true;
};
# Mullvadvpn
services.mullvad-vpn.enable = true;
services.mullvad-vpn.package = pkgs.mullvad-vpn;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# # Define a user account. Don't forget to set a password with 'passwd'.
# users.users.misha = {
# isNormalUser = true;
# description = "misha";
# extraGroups = [ "networkmanager" "wheel" ];
# packages = with pkgs; [
# # thunderbird
# ];
# };
# # Add this to create the mlocate group
users.groups.mlocate = {};
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
git
wget
vimHugeX #for clipboard support (also add "set clipboard=unnamedplus" to ~/.vimrc)
lf # ranger alternative
keyd # for keybindings
ncdu # for storage overview
mlocate
nextcloud-client
signal-desktop
element-desktop
vlc
obs-studio
drawio
ripgrep
unzip
dconf
dconf-editor
dconf2nix
pass
gnupg
wofi
xdotool #To focus/start Emacs
wmctrl #To focus/start Emacs?
libreoffice
sqlite
mullvad-vpn
calibre
offlineimap
mu
msmtp
texliveFull
recoll
hugo
ardour
stellarium
hunspell
hunspellDicts.nl_NL
hunspellDicts.en_US
eduvpn-client
wl-clipboard
dunst
xsel #to copy/clip with launcher
xclip #to copy/clip with launcher
jq
dmenu
poppler_utils # for rename-from-doi
telegram-desktop
yt-dlp
qemu
quickemu
imagemagick
ghostscript
transmission_4-gtk
okular
xournalpp
silver-searcher
pdfarranger
ollama
aegisub
ffmpeg
pdftk
file # to check file type
ethercalc
tesseract
qrencode
virtualenv
traceroute
wpa_supplicant
qgis
age
inxi
toybox
ungoogled-chromium
(python3.withPackages (ps: [
ps.msal
ps.psutil
ps.pandas
ps.deemix
ps.openpyxl
ps.beautifulsoup4
ps.dbus-python
ps.matplotlib
]))
gnome-tweaks
gnomeExtensions.appindicator
gnomeExtensions.clipboard-indicator
((emacsPackagesFor emacs).emacsWithPackages (
epkgs: [
epkgs.evil
epkgs.evil-collection
epkgs.evil-surround
epkgs.magit
epkgs.ivy
epkgs.counsel
epkgs.ivy-prescient
epkgs.winum
epkgs.dirvish
epkgs.all-the-icons
epkgs.pdf-tools
epkgs.standard-themes
epkgs.gptel
epkgs.org-noter
epkgs.org-roam
epkgs.org-roam-ui
epkgs.ox-reveal
epkgs.mu4e
epkgs.org-msg
epkgs.f
epkgs.auctex
epkgs.yasnippet
epkgs.yasnippet-snippets
epkgs.google-translate
epkgs.markdown-mode
epkgs.nix-mode
]))
];
# MVR: this keeps the laptop on when the lid closes
# systemd.sleep.extraConfig = ''
# AllowSuspend=no
# AllowHibernation=no
# AllowHybridSleep=no
# AllowSuspendThenHibernate=no
# '';
# MVR: this maps the arrows
services.keyd = {
enable = true;
keyboards = {
# The name is just the name of the configuration file, it does not really matter
default = {
ids = [ "*" ]; # what goes into the [id] section, here we select all keyboards
# Everything but the ID section:
settings = {
# The main layer, if you choose to declare it in Nix
main = {
capslock = "layer(control)"; # you might need to also enclose the key in quotes if it contains non-alphabetical symbols
};
otherlayer = {};
};
extraConfig = ''
[ids]
*
[main]
capslock = overload(capslock, esc)
# The default shift layer (the layer activated when shift is pressed).
[shift]
capslock = layer(capslock_shift)
[capslock:C]
shift = layer(capslock_shift)
h = left
j = down
k = up
l = right
u = home
i = end
y = pageup
o = pagedown
[capslock_shift]
h = left
j = C-down
k = C-up
l = right
u = home
i = end
# put here any extra-config, e.g. you can copy/paste here directly a configuration, just remove the ids part
'';
};
};
};
# GnuPG
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
services.pcscd.enable = true;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
##------SSH
# Enable the OpenSSH daemon.
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [ 22 51413 ];
# Enable cron service
services.cron = {
enable = true;
systemCronJobs = [
"*/30 * * * * misha . /etc/profile; offlineimap -c /etc/nixos/other-config/mail/imap/.offlineimaprc"
"*/10 * * * * misha . /etc/profile; offlineimap -c /etc/nixos/other-config/mail/imap/.offlineimaprc_quick"
"0 */4 * * * misha . recollindex"
];
};
#<2025-02-03 ma> it looks like some programs, when you install them
#create conflicts with home-manager files. This setting appears to prevent that.
#home-manager.backupFileExtension = "backup-mv";
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}

159
flake.lock generated Normal file
View file

@ -0,0 +1,159 @@
{
"nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"systems": "systems"
},
"locked": {
"lastModified": 1736955230,
"narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=",
"owner": "ryantm",
"repo": "agenix",
"rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703113217,
"narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1739757849,
"narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1703013332,
"narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1731755305,
"narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1741196730,
"narHash": "sha256-0Sj6ZKjCpQMfWnN0NURqRCQn2ob7YtXTAOTwCuz7fkA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "48913d8f9127ea6530a2a2f1bd4daa1b8685d8a3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"agenix": "agenix",
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_3"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

48
flake.nix Normal file
View file

@ -0,0 +1,48 @@
{
description = "My flakes configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager.url = "github:nix-community/home-manager/release-24.11";
agenix.url = "github:ryantm/agenix";
};
outputs = { self,
nixpkgs,
home-manager,
agenix,
}@inputs:
let
system = "x86_64-linux";
specialArgs = inputs // { inherit system; };
shared-modules = [
home-manager.nixosModules.home-manager
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
{
home-manager = {
useUserPackages = true;
extraSpecialArgs = specialArgs;
};
}
];
in
{
nixosConfigurations = {
rbp = nixpkgs.lib.nixosSystem {
specialArgs = specialArgs;
system = system;
modules = shared-modules ++ [ ./rbp.nix];
};
ml1 = nixpkgs.lib.nixosSystem {
specialArgs = specialArgs;
system = system;
modules = shared-modules ++ [
./ml1.nix
agenix.nixosModules.default
];
};
};
};
}

216
home.nix Normal file
View file

@ -0,0 +1,216 @@
{ pkgs, lib, ...}:
with lib.hm.gvariant;
{
programs.vim.defaultEditor = true;
programs.bash = {
enable = true;
shellAliases = {
# Navigation
ll = "${pkgs.coreutils}/bin/ls -al";
l = "ls -ltrha";
cb = "cd .. && l";
dw = "cd ~/Downloads && l";
# Misc
nb = "sudo nixos-rebuild switch";
rgm = "rg --type org";
deem = "deemix -p ~/Downloads/deemix/ -b 128";
em = "emacsclient -n";
offlineimap_quick = "offlineimap -c /etc/nixos/other-config/mail/imap/.offlineimaprc_quick";
# ssh
ssh_transip = "ssh misha@\$(pass ip/transip)";
ml2 = "ssh misha@\$(pass ip/ml2)";
rbp = "ssh -p \$(pass ip/port1) misha@\$(pass ip/ml2)";
gandi = "ssh misha@\$(pass ip/gandi)";
update_website = "bash /etc/nixos/other-config/emacs/update_website.sh";
};
};
xdg.mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "firefox.desktop";
"image/png" = "org.gnome.Loupe.desktop";
"image/jpeg" = "org.gnome.Loupe.desktop";
"image/jpg" = "org.gnome.Loupe.desktop";
"application/xhtml+xml" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = "writer.desktop";
"application/pdf" = "org.kde.okular.desktop"; # Add this line for PDFs
};
};
dconf = {
enable = true;
settings = {
"org/gnome/shell" = {
disable-user-extensions = false; # enables user extensions
enabled-extensions = [
# Put UUIDs of extensions that you want to enable here.
# If the extension you want to enable is packaged in nixpkgs,
# you can easily get its UUID by accessing its extensionUuid
# field (look at the following example).
"appindicatorsupport@rgcjonas.gmail.com" #gnomeExtensions-appindicator
"clipboard-indicator@tudmotu.com"
## Alternatively, you can manually pass UUID as a string.
#"blur-my-shell@aunetx"
# ...
];
};
"org/gnome/desktop/peripherals/mouse" = {
natural-scroll = true;
};
"org/gnome/desktop/interface" = {
clock-show-weekday = true;
};
"org/gnome/desktop/interface" = {
show-battery-percentage = true;
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
"org/gnome/desktop/session" = {
idle-delay = mkUint32 0;
};
"org/gnome/desktop/peripherals/touchpad" = {
speed = 0.37;
};
"org/gnome/settings-daemon/plugins/power" = {
sleep-inactive-battery-type = "nothing";
sleep-inactive-ac-type = "nothing";
idle-dim = false;
};
"org/gnome/desktop/input-sources" = {
xkb-options = [ "compose:ralt" ];
};
"org/gnome/desktop/sound" = {
event-sounds = false;
};
"org/gnome/desktop/interface" = {
enable-hot-corners = false;
};
"org/gnome/Console" = {
use-system-font = false;
custom-font = "Liberation Mono";
};
"org/gnome/desktop/wm/keybindings" = {
switch-input-source = [];
switch-input-source-backward = [];
};
"org/gnome/desktop/background" = {
picture-uri = "file:///etc/nixos/img/wallpaper.jpg";
picture-uri-dark = "file:///etc/nixos/img/wallpaper.jpg";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
###------keybindings-----------#####
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/"
];
#home = ["<Super>d"];
magnifier = ["<Alt><Super>8"];
magnifier-zoom-in = ["<Alt><Super>equal"];
magnifier-zoom-out = ["<Alt><Super>minus"];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Alt>e";
command = "python /etc/nixos/other-config/emacs/emacs_activate.py";
name = "Activate Emacs";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Super>d";
command = "wmctrl -k on";
name = "Activate desktop";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = {
binding = "<Super>b";
command = "bash /etc/nixos/other-config/wofi/ffb.sh";
name = "Launch bookmarks";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3" = {
binding = "<Super>q";
command = "bash /etc/nixos/other-config/wofi/kill.sh";
name = "Clear wofi and notifications";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4" = {
binding = "<Super>space";
command = "bash /etc/nixos/other-config/wofi/launcher/launcher.sh";
name = "Run wofi launcher";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = {
binding = "<Super>w";
command = "bash /etc/nixos/other-config/wofi/launcher/remove-history.sh";
name = "Clear ChatGPT history";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6" = {
binding = "<Shift><Alt>d";
command = "bash /etc/nixos/other-config/wofi/launcher/scripts/translate.sh";
name = "General translate";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7" = {
binding = "<Shift><Alt>p";
command = "bash /etc/nixos/other-config/shutdown.sh";
name = "General translate";
};
###------keybindings-----------#####
};
};
programs.vim = {
enable = true;
# Optional: Provide a custom vimrc
extraConfig = ''
set number
set clipboard=unnamedplus
'';
};
programs.git = {
enable = true;
userName = "Misha";
userEmail = "mail@mishathings.com";
};
}

57
host1.nix Normal file
View file

@ -0,0 +1,57 @@
# The laptop at the Kerkelaan
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
./misha.nix
./ireneco.nix
./configuration.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
#--------------------------------
#From configuration.nix
#--------------------------------
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "host1"; # Define your hostname.
#--------------------------------
#--------------------------------
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/fee7b70d-de2b-4b8b-b081-0126a32044f4";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/6B80-F46A";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/fc4d2e6b-c008-4ae6-b1cd-aa4ed7440027"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s25.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wwp0s20u4.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

BIN
img/chris-setup.jpg Normal file

Binary file not shown.

After

(image error) Size: 42 KiB

BIN
img/wallpaper.jpg Normal file

Binary file not shown.

After

(image error) Size: 70 KiB

29
ireneco.nix Normal file
View file

@ -0,0 +1,29 @@
{ pkgs, ...}:
{
users.users.ireneco = {
isNormalUser = true;
home = "/home/ireneco";
initialPassword = "abc123";
description = "ireneco";
extraGroups = [ "wheel" "networkmanager" ];
#openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIbg21Lgz4VcdLbAe/0SZKfmiSO2Dpmn... R0n6auXyofCAAuzy5WZjz29jAWMdKc= misha@debian"]; #example
};
home-manager = {
users.ireneco = {
imports = [ ./home.nix ];
home.stateVersion = "24.11";
home.language = {
base = "nl_NL.UTF-8";};
};
};
}

31
misha.nix Normal file
View file

@ -0,0 +1,31 @@
{ pkgs, config, ...}:
{
users.users.misha = {
isNormalUser = true;
description = "anonymous";
home = "/home/misha";
extraGroups = [
"wheel"
"networkmanager"
"mlocate"
];
};
home-manager = {
users.misha = {
imports = [ ./home.nix ];
home.stateVersion = "24.11";
# <2025-03-19 wo> This apparently solves the mimeapps.list clash
home.file."/home/misha/.config/mimeapps.list".force = pkgs.lib.mkForce true;
};
};
}

56
ml1.nix Normal file
View file

@ -0,0 +1,56 @@
# Do not modify this file! It was generated by 'nixos-generate-config'
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
./misha.nix
./configuration.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
#----------------
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices."luks-75fbd436-3b4f-4912-b852-0f7be90995a9".device = "/dev/disk/by-uuid/75fbd436-3b4f-4912-b852-0f7be90995a9";
networking.hostName = "ml1"; # Define your hostname.
#----------------
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/64c9ea8b-4eb9-499a-98f4-38503da411cc";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-a64b0860-6c07-4e98-b80f-b7e79ab955db".device = "/dev/disk/by-uuid/a64b0860-6c07-4e98-b80f-b7e79ab955db";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/C8D5-2D48";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/1c3c3f02-9e41-4852-be85-11b37dda3f33"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1 @@
73E71F57F1307CA869271726A82278E69ECE11DF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
 ¥ÁÑN,þ+PÂ3h$<nj{׿•TœÁÏ=>½ª¶¤°t
ùÉÞm…
âŽg|EN'é30ŒwA馤¤¡[‰žP3" <>½t¾¿¥!N<>! *_âë<C3A2>UÐèã1°-ùϡһÆÞ'£V p…”ÏLc¶p
6!Vö¿ÉÒGC+:&CŠqÒ1ð<>ήRï_@Zi„'B¬JѽöÉp¼„p|~`ºêú¢1¢#úãõ8"É~ǼãáÓºkaÐç<°˜£«4'js>âh*˜8)<29>-§Ø4Â<34>Ö?ª.XÛj[ÿäƒÛ”<C39B>7š=tÕ0Ôo 6âæwËãe´ãH,Ò÷s?&MTÖ—ªðì&¬—ÓýKÑÓA‹¢âÕ«“<#Tñ<54>j(s·åuÿÙëß?¼m£ì¹¦íóD<A<4C>('‡euô«ÖyÙ¶ÿ¤Ýe.Èû«ð

View file

@ -0,0 +1 @@
 ¥ÁÑN,ÿn<C3BF>œ(Åô<ÿlÝ}w„÷íBá<42>p¶ÇÝg­¨íéÍ÷ƒ“E<·TТ~²uÞ.%Q*ƒ x[n…=*æk<ÿH¤¼GvEöø&E=ÿÎ<1A>ƒ†2jî ™jTþÖÂóô¡ø-.? ÅhX`™œˆ¸¹|Å´\ßæÐBþù!¶˜ñò6ñpxS¶]Úµ['Þ…Ó/ÈmÉ1"¾Ã$?]N8ÈÒD  @Q]e@¬»f_ËÆÔƒ n6F·u¦‰\£4Z¿÷”èÂb%\XB¿å¡K;:(ð©Ãn:E4Ám“Ä:´º1 ñTãÙ„Pذ(÷(£¼u~ÕÔU C†#œÕ uij$':QTEDZØÖX.°èÀE¶]¡*³QÕUpõ)nŠq¢~îßfWêr‰ÅýhéUé[kârÝ¡<C39D>‡¨­Ð(KG„ î/ôä¢

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

35
other-config/dotfiles.sh Normal file
View file

@ -0,0 +1,35 @@
# Password
rm -rf /home/misha/.password-store
ln -s /etc/nixos/other-config/.password-store /home/misha/
# Mail
mkdir -p /home/misha/Maildir
rm -f /home/misha/.offlineimaprc
ln -s /etc/nixos/other-config/mail/imap/.offlineimaprc /home/misha/
rm -f /home/misha/.msmtprc
ln -s /etc/nixos/other-config/mail/smtp/.msmtprc /home/misha/
# Emacs
rm -f /home/misha/.emacs.d/README.org
ln -s /etc/nixos/other-config/emacs/README.org /home/misha/.emacs.d/
touch /home/misha/.emacs.d/custom.el
rm -f /home/misha/.emacs.d/init.el
ln -s /etc/nixos/other-config/emacs/init.el /home/misha/.emacs.d/
rm -rf /home/misha/.emacs.d/snippets
ln -s /etc/nixos/other-config/emacs/snippets/ /home/misha/.emacs.d/
rm /home/misha/.authinfo.gpg
ln -s /etc/nixos/other-config/emacs/caldav/.authinfo.gpg /home/misha/
rm -r /home/misha/.emacs.d/custom.el
ln -s /etc/nixos/other-config/emacs/custom.el /home/misha/.emacs.d/
# Recoll
rm -f /home/misha/.recoll/recoll.conf
ln -s /etc/nixos/other-config/recoll/recoll.conf /home/misha/.recoll/
rm -f /home/misha/.recoll/fragbuts.xml
ln -s /etc/nixos/other-config/recoll/fragbuts.xml /home/misha/.recoll/

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
;;; -*- lexical-binding: t -*-
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("c7fd1708e08544d1df2cba59b85bd25263180b19b287489d4f17b9118487e718"
"cfb0bb44259cf576124b900613628f4b589df1c3860185d24fffde6666bc88cf"
"cdad4e5bc718111deb1f1a2a35e9781e11724144a1eb2064732c337160946760"
default))
'(package-selected-packages nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(mu4e-header-highlight-face ((t (:inherit ## :extend t))))
'(mu4e-replied-face ((t (:foreground unspecified))))
'(org-level-1 ((t (:inherit outline-1 :height 1.3))))
'(org-level-2 ((t (:inherit outline-2 :height 1.2))))
'(org-level-3 ((t (:inherit outline-3 :height 1.1))))
'(org-level-4 ((t (:inherit outline-4 :height 1.0))))
'(org-level-5 ((t (:inherit outline-5 :height 1.0)))))

View file

@ -0,0 +1,8 @@
#!/usr/bin/env python
import sys
import os
for line in sys.stdin:
if os.path.isdir(line[:-1]):
sys.stdout.write(line)

View file

@ -0,0 +1,23 @@
#!/usr/bin/python3
import psutil
import os
check=0
for proc in psutil.process_iter(attrs=['pid', 'name', 'username']):
if proc.info['name'] == "emacs":
print(proc.info['name'])
print(proc.info['pid'])
os.system("for i in $(xdotool search --pid %s); do xdotool windowactivate $i ; done" % (proc.info['pid']))
#os.system("xdotool windowactivate `xdotool search --pid %s | tail -1`" % (proc.info['pid']))
#os.system("xdotool search \"emacs\" windowactivate")
check=1
if check == 0:
if os.path.exists("/home/misha/ml2"):
#os.system("emacs --with-profile spacemacs2")
os.system("emacs")
else:
#os.system("emacs --with-profile spacemacs2")
os.system("emacs")

View file

@ -0,0 +1,10 @@
;; -*- lexical-binding: t; -*-
(setq vc-follow-symlinks nil) ;; this prevents Emacs from asking if I want to follow the symlink in a git
(require 'org)
(org-babel-tangle-file (expand-file-name "README.org" user-emacs-directory))
(load-file (expand-file-name "config.el" user-emacs-directory))
(setq custom-file
(expand-file-name "custom.el" user-emacs-directory))
(load custom-file)
(put 'narrow-to-region 'disabled nil)

View file

@ -0,0 +1,2 @@
echo -n "$1" | grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' | tr -d '\n'

View file

@ -0,0 +1,49 @@
import os
import mmap
root_directory = os.fsencode("/home/misha/Maildir/uva/INBOX/")
tags = []
# Walk through all sub-directories and files
for directory, subdirectories, filenames in os.walk(root_directory):
for filename in filenames:
full_file = os.path.join(directory, filename)
with open(full_file, 'rb') as f:
for line in f:
line = line.decode('utf-8','ignore')if isinstance(line, bytes) else line
if 'X-Keywords' in line:
add = line.split(": ")[-1].replace("\n","")
if add != "":
tags.append(add)
taglist = ""
for i in (list(set(tags))):
taglist = '%s,%s' % (taglist, i.replace("\n",""))
print(taglist[1:], end="")
# import os
# import mmap
# directory = os.fsencode("/home/misha/Maildir/uva/INBOX/")
# #directory = os.fsencode("/home/misha/Maildir/transip/uva.inbox-uva/cur")
# tags=[]
# for filename in os.listdir(directory):
# full_file=os.path.join(directory, filename)
# with open(full_file) as f:
# for line in f:
# if 'X-Keywords' in line:
# #print(line)
# add=line.split(": ")[-1].replace("\n","")
# if add != "":
# tags.append(add)
# taglist=""
# for i in (list(set(tags))):
# # print(i,end="")
# taglist='%s,%s' % (taglist,i.replace("\n",""))
# print(taglist[1:],end="")

View file

@ -0,0 +1,100 @@
;;; mu4e-goodies-tags.el --- Provide useful functions to use tags in mu4e -*- lexical-binding: t; -*-
;; Copyright (C) 2014-2019 Pan Jie
;; Author: Pan Jie <panjie@gmail.com>
;; Created: 2014-10-8
;; Version: 1.0
;; Package-Requires: ((emacs "25.1"))
;; Keywords: email tools
;; URL: https://github.com/panjie/mu4e-goodies
;; License: https://github.com/panjie/mu4e-goodies/LICENSE
;; This file is not a part of GNU Emacs.
;;; Code:
(require 'mu4e)
(require 'mu4e-goodies-utils)
;;
;; Provide some usable functions to use tags in mu4e
;;
;; Tags for emails (from info pages of mu4e)
;;--------------------------------------------------
(add-to-list 'mu4e-marks
'(tag
:char ("g" . " ")
:prompt "gtag"
:ask-target (lambda () (read-string "What tag do you want to add/remove(+/-): "))
:action (lambda (docid msg target)
(mu4e-action-retag-message msg target))))
(mu4e~headers-defun-mark-for tag)
(define-key mu4e-headers-mode-map (kbd "G") 'mu4e-headers-mark-for-tag)
(define-key-after (lookup-key mu4e-headers-mode-map [menu-bar headers])
[mark-tag] '("Mark for tag" . mu4e-headers-mark-for-tag) 'mark-pattern)
;; actions to add tags
(add-to-list 'mu4e-view-actions
'("add/remove tags" . mu4e-action-retag-message) t)
;; Quickly add/remove/search tag (named QT**) in header/message view
;;--------------------------------------------------
(defvar mu4e-goodies~quick-tag "QT**"
"Quick tag.")
(defun mu4e-goodies-add-del-quick-tag ()
"Quickly add/del tags."
(interactive)
(let* ((msg (mu4e-message-at-point))
(oldtags (mu4e-message-field msg :tags)))
(if (member mu4e-goodies~quick-tag oldtags)
(mu4e-action-retag-message msg (concat "-" mu4e-goodies~quick-tag))
(mu4e-action-retag-message msg (concat "+" mu4e-goodies~quick-tag)))))
;; flag maybe a better choice than tag so the following code is useless
;; (define-key mu4e-headers-mode-map (kbd "M") 'mu4e-goodies-add-del-quick-tag)
;; (define-key mu4e-view-mode-map (kbd "M") 'mu4e-goodies-add-del-quick-tag)
;; (define-key mu4e-headers-mode-map (kbd "k") (lambda ()
;; (interactive)
;; (mu4e~headers-search-execute (concat "tag:" mu4e-goodies~quick-tag) t)))
;;
;; Show tags in the header view
;;
(defface mu4e-goodies-face-tags
'((((class color) (background light)) :weight bold :foreground "#8CD0D3")
(((class color) (background dark)) :weight bold :foreground "#8CD0D3"))
"Face for show tags in header view."
:group 'mu4e-goodies)
(defun mu4e-goodies-header-add-tags-handler (msg field f-v str)
"Add tags to header view's subject field like: [TAG][TAG] subject..."
(let* ((val (or str f-v)))
(if (eq field :subject)
(let ((tags (mu4e-message-field msg :tags)))
(if tags
(setq val (concat
(mapconcat (function (lambda (x) (propertize (concat "[" x "]") 'face 'mu4e-goodies-face-tags)))
tags "")
" "
val))
val))
val)))
(cond ((functionp 'mu4e~headers-field-value) ; for mu>=1.5
(add-to-list 'mu4e-goodies~header-handlers 'mu4e-goodies-header-add-tags-handler))
((listp 'mu4e~headers-field-handler-functions) ; for mu<1.5
(add-to-list 'mu4e~headers-field-handler-functions (lambda (msg field val width)
"" (mu4e-goodies-header-add-tags-handler msg field val nil))))
(t nil))
(provide 'mu4e-goodies-tags)
;;; mu4e-goodies-tags.el ends here

View file

@ -0,0 +1,51 @@
;;; mu4e-goodies-utils.el --- Some common functions -*- lexical-binding: t; -*-
;; Copyright (C) 2014-2019 Pan Jie
;; Author: Pan Jie <panjie@gmail.com>
;; Created: 2014-10-8
;; Version: 1.0
;; Package-Requires: ((emacs "25.1"))
;; Keywords: email tools
;; URL: https://github.com/panjie/mu4e-goodies
;; License: https://github.com/panjie/mu4e-goodies/LICENSE
;; This file is not a part of GNU Emacs.
;;; Code:
(require 'mu4e)
;;
;; some utility functions
;;
(defsubst mu4e-goodies~get-real-addr (addr)
"Parse addr which is the result of mu4e-message-fields to get
the real email address"
(if (listp addr) ;; already parsed by mu4e
(cdr (car addr))
(if (stringp addr) ;; raw address like: "ABC <abc@abc.com>"
(car (mail-header-parse-address addr)))))
(defvar mu4e-goodies~header-handlers nil
"Internal handlers of header view for mu >= 1.5")
(defun mu4e-goodies~header-advice (orig-func &rest args)
"General advice for plugins for header view"
(let* ((str (apply orig-func args))
(msg (car args))
(field (cadr args)))
(dolist (func mu4e-goodies~header-handlers)
(setq str (funcall func msg field (mu4e-message-field msg field) str)))
str))
(when (functionp 'mu4e~headers-field-value) ; mu >= 1.5
(advice-add 'mu4e~headers-field-value :around #'mu4e-goodies~header-advice))
(provide 'mu4e-goodies-utils)
;;; mu4e-goodies-utils.el ends here

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,389 @@
;;; mu4e-thread-folding.el --- Thread folding support for mu4e -*- lexical-binding: t -*-
;; Copyright (C) 2021 Nicolas P. Rougier
;;
;; Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
;; Homepage: https://github.com/rougier/mu4e-thread-folding
;; Keywords: mail
;; Version: 0.2
;; Package-Requires: ((emacs "26.1"))
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; mu4e-thread-folding.el is a small library to enable threads folding in
;; mu4e. This works by using overlays with an invisible property and
;; setting hooks at the right place. It is possible to configure colors
;; to better highlight a thread and also to have a prefix string
;; indicating if a thread is folded or not. Note that when a thread is
;; folded, any unread child remains visible.
;; Usage:
;; The prefix string is displayed over the header line and it is thus
;; recommended to have an empty field at the start of an header line.
;; Have a look at ~mu4e-headers-fields~.
;;
;; (require 'mu4e-thread-folding)
;; (add-to-list 'mu4e-header-info-custom
;; '(:empty . (:name "Empty"
;; :shortname ""
;; :function (lambda (msg) " "))))
;; (setq mu4e-headers-fields '((:empty . 2)
;; (:human-date . 12)
;; (:flags . 6)
;; (:mailing-list . 10)
;; (:from . 22)
;; (:subject . nil)))
;;; Code:
(require 'mu4e)
(defvar mu4e-thread-folding-mode nil)
(defvar mu4e-headers--folded-items nil)
(defgroup mu4e-thread-folding '()
"Group for mu4e thread folding options"
:group 'mu4e)
(defface mu4e-thread-folding-root-unfolded-face
`((t :inherit 'default))
"Face for the root node thread when it is unfolded."
:group 'mu4e-thread-folding)
(defface mu4e-thread-folding-root-folded-face
`((t :inherit 'default))
"Face for the root node of a thread when it is folded."
:group 'mu4e-thread-folding)
(defface mu4e-thread-folding-child-face
`((t :inherit 'default))
"Face for a thread when it is unfolded (child node)"
:group 'mu4e-thread-folding)
(defface mu4e-thread-folding-root-prefix-face
`((t :inherit default))
"Face for the root node thread when it is unfolded."
:group 'mu4e-thread-folding)
(defcustom mu4e-thread-folding-default-view 'folded
"Initial folding status ('folded or 'unfolded)."
:type 'string
:group 'mu4e-thread-folding)
(defcustom mu4e-thread-folding-root-unfolded-prefix-string
"[%2d] ▾"
"Prefix for the root node thread when it is unfolded."
:type 'string
:group 'mu4e-thread-folding)
(defcustom mu4e-thread-folding-root-folded-prefix-string
"[%2d] ▸"
"Prefix for the root node (when folded)"
:type 'string
:group 'mu4e-thread-folding)
(defcustom mu4e-thread-folding-child-prefix-string
" "
"Prefix for a child node."
:type 'string
:group 'mu4e-thread-folding)
(defcustom mu4e-thread-folding-keep-faces nil
"Whether or not to overwrite faces."
:type 'boolean
:group 'mu4e-thread-folding)
(defvar mu4e-thread-folding-all-folded nil
"Record whether last fold-all state was folded.")
(defun mu4e-headers-get-thread-id (msg)
"Retrieve the thread-id of a msg.
This uses the mu4e private API and this might break in future releases."
(mu4e~headers-get-thread-info msg 'thread-id))
(defun mu4e-headers-mark-threads (&optional no-reset)
"Mark line in headers view with various information contained in overlays."
(when (and (get-buffer "*mu4e-headers*") mu4e-headers-show-threads)
(with-current-buffer "*mu4e-headers*"
(setq-local line-move-visual t
line-move-ignore-invisible t)
;; turn on minor mode for key bindings
(unless mu4e-thread-folding-mode (mu4e-thread-folding-mode 1))
;; Remove all overlays
(cl-loop with names = '(thread-child thread-root root-prefix)
for ov being the overlays
when (cl-loop for name in names
thereis (overlay-get ov name))
do (delete-overlay ov))
(unless no-reset (setq mu4e-headers--folded-items nil))
(setq-local left-margin-width 1)
(if (get-buffer-window "*mu4e-headers*")
(set-window-margins (get-buffer-window "*mu4e-headers*")
(max (length mu4e-thread-folding-root-folded-prefix-string)
(length mu4e-thread-folding-root-unfolded-prefix-string))))
(let ((overlay-priority -60)
(folded (string= mu4e-thread-folding-default-view 'folded))
(child-face 'mu4e-thread-folding-child-face)
(children-number 1)
(root-id nil)
(root-overlay nil)
(root-unread-child nil)
docid-overlay
(root-folded-face 'mu4e-thread-folding-root-folded-face)
(root-unfolded-face 'mu4e-thread-folding-root-unfolded-face)
(root-folded-prefix mu4e-thread-folding-root-folded-prefix-string)
(root-unfolded-prefix mu4e-thread-folding-root-unfolded-prefix-string))
;; store initial folded state
(setq mu4e-thread-folding-all-folded folded)
(setq-local buffer-invisibility-spec '(docid t))
;; Iterate over each header
(mu4e-headers-for-each
(lambda (msg)
(let* ((docid (mu4e-message-field msg :docid))
(docid-pos (cons (mu4e~headers-goto-docid docid)
(mu4e~headers-goto-docid docid t)))
(id (mu4e-headers-get-thread-id msg))
(flagged (member 'flagged (mu4e-message-field msg :flags)))
(unread (member 'unread (mu4e-message-field msg :flags)))
(child-overlay (make-overlay
(line-beginning-position)
(+ 1 (line-end-position)))))
;; (setq folded (or (and (member id mu4e-headers--folded-items) t)
;; mu4e-thread-folding-all-folded))
(setq folded (member id mu4e-headers--folded-items))
;; We mark the root thread if and only if there's child
(if (string= root-id id)
(progn
(setq children-number (+ children-number 1))
;; unread-child indicates that there's at least one unread child
(setq root-unread-child (or root-unread-child unread))
;; Child
(when (and (not unread) (not flagged) (not mu4e-thread-folding-keep-faces))
(overlay-put child-overlay 'face child-face))
(overlay-put child-overlay 'invisible (and folded (not unread)))
(overlay-put child-overlay 'priority overlay-priority)
(overlay-put child-overlay 'unread unread)
(overlay-put child-overlay 'thread-child t)
(overlay-put child-overlay 'thread-id id)
;; Root
(when (not mu4e-thread-folding-keep-faces)
(overlay-put
root-overlay 'face (if (or root-unread-child (not folded))
root-unfolded-face
root-folded-face)))
(overlay-put root-overlay 'thread-root t)
(overlay-put root-overlay 'thread-id id)
(overlay-put root-overlay 'folded folded)
(overlay-put root-overlay 'priority overlay-priority)
(overlay-put root-overlay 'invisible 'root)
(overlay-put root-overlay 'prefix-docid docid-overlay)
(overlay-put
docid-overlay 'before-string
(propertize
" " 'display
`((margin left-margin)
,(propertize
(if (or root-unread-child (not folded))
(format root-unfolded-prefix children-number)
(format root-folded-prefix children-number))
'face 'mu4e-thread-folding-root-prefix-face))))
(overlay-put docid-overlay 'invisible 'docid)
(overlay-put docid-overlay 'priority 1)
(overlay-put docid-overlay 'root-prefix t))
;; Else, set the new root (this relies on default message order in header's view)
(progn
(if (> children-number 1)
(overlay-put root-overlay 'children-number children-number))
(setq root-id id
root-unread-child nil
children-number 1
root-overlay (make-overlay
(line-beginning-position)
(1+ (line-end-position)))
docid-overlay (make-overlay
(car docid-pos)
(cdr docid-pos))))))))))))
(defun mu4e-headers-mark-threads-no-reset ()
"Same as `mu4e-headers-mark-threads' but don't reset `mu4e-headers--folded-items'."
(mu4e-headers-mark-threads 'no-reset))
(defun mu4e-headers-overlay-set-visibility (value &optional thread-id)
"Set the invisible property for all thread children or only the ones matching thread-id.
Unread message are not folded."
(when (and (get-buffer "*mu4e-headers*") mu4e-headers-show-threads)
(with-current-buffer "*mu4e-headers*"
(unless thread-id
(setq mu4e-thread-folding-all-folded value))
(save-excursion
(goto-char (point-min))
(let ((root-overlay nil)
(child-overlay nil)
(root-folded-face 'mu4e-thread-folding-root-folded-face)
(root-unfolded-face 'mu4e-thread-folding-root-unfolded-face)
(root-folded-prefix mu4e-thread-folding-root-folded-prefix-string)
(root-unfolded-prefix mu4e-thread-folding-root-unfolded-prefix-string))
(mu4e-headers-for-each
(lambda (_msg)
(let (local-child-overlay local-root-overlay)
(cl-loop for ov in (overlays-in (point-at-bol) (point-at-eol))
when (overlay-get ov 'thread-child)
do (setq local-child-overlay ov)
when (overlay-get ov 'thread-root)
do (setq local-root-overlay ov))
;; Child
(when local-child-overlay
(let ((id (overlay-get local-child-overlay 'thread-id))
(unread (overlay-get local-child-overlay 'unread)))
(setq child-overlay local-child-overlay)
(when (or (not thread-id) (string= id thread-id))
(if (and root-overlay unread (not mu4e-thread-folding-keep-faces))
(overlay-put root-overlay 'face root-unfolded-face)
(overlay-put child-overlay 'invisible value)))))
;; Root
(when local-root-overlay
(let ((children-number (or (overlay-get local-root-overlay 'children-number) 1))
(id (overlay-get local-root-overlay 'thread-id)))
(setq root-overlay local-root-overlay)
(when (or (not thread-id) (string= id thread-id))
(if (and (overlay-get root-overlay 'folded) (null value))
(setq mu4e-headers--folded-items
(delete id mu4e-headers--folded-items))
(push id mu4e-headers--folded-items))
(overlay-put root-overlay 'folded value)
(overlay-put
(overlay-get root-overlay 'prefix-docid) 'before-string
(propertize
" " 'display
`((margin left-margin)
,(propertize
(if value
(format root-folded-prefix children-number)
(format root-unfolded-prefix children-number))
'face 'mu4e-thread-folding-root-prefix-face))))
(when (not mu4e-thread-folding-keep-faces)
(overlay-put
root-overlay 'face (if value
root-folded-face
root-unfolded-face))))))
;; Not a root, not a child, we reset the root overlay
(when (and (not local-child-overlay) (not local-root-overlay))
(setq root-overlay nil))))))))))
(defun mu4e-headers-get-overlay (prop &optional index)
"Get overlay at point having the PROP property"
(let* ((index (or index 0))
(overlays (overlays-at (+ (point) index)))
found)
(while (and overlays (not found))
(let ((overlay (car overlays)))
(if (overlay-get overlay prop)
(setq found overlay)))
(setq overlays (cdr overlays)))
found))
(defun mu4e-headers-toggle-at-point ()
"Toggle visibility of the thread at point"
(interactive)
(when (get-buffer "*mu4e-headers*")
(with-current-buffer "*mu4e-headers*"
(catch 'break
(while (and (not (mu4e-headers--toggle-internal))
(not (bobp)))
(forward-line -1))))))
(defun mu4e-headers--toggle-internal ()
"Toggle visibility of the thread at point"
(let (child-overlay root-overlay)
(cl-loop for ov in (overlays-in (point-at-bol) (point-at-eol))
when (overlay-get ov 'thread-child)
return (setq child-overlay ov)
when (overlay-get ov 'thread-root)
return (setq root-overlay ov))
(cond (root-overlay
(let ((id (overlay-get root-overlay 'thread-id))
(folded (overlay-get root-overlay 'folded)))
(mu4e-headers-overlay-set-visibility (not folded) id)
(throw 'break t)))
((not child-overlay)
(throw 'break t)))))
(defun mu4e-headers-toggle-fold-all ()
"Toggle between all threads unfolded and all threads folded."
(interactive)
(mu4e-headers-overlay-set-visibility
(not mu4e-thread-folding-all-folded)))
(defun mu4e-headers-fold-all ()
"Fold all threads"
(interactive)
(mu4e-headers-overlay-set-visibility t))
(defun mu4e-headers-unfold-all ()
"Unfold all threads"
(interactive)
(mu4e-headers-overlay-set-visibility nil))
(defun mu4e-headers-fold-at-point ()
"Fold current thread at point"
(interactive)
(if (get-buffer "*mu4e-headers*")
(with-current-buffer "*mu4e-headers*"
(let ((overlay (mu4e-headers-get-overlay 'thread-id)))
(mu4e-headers-overlay-set-visibility t (overlay-get overlay 'thread-id))))))
(defun mu4e-headers-unfold-at-point ()
"Unfold current thread at point"
(interactive)
(if (get-buffer "*mu4e-headers*")
(with-current-buffer "*mu4e-headers*"
(let ((overlay (mu4e-headers-get-overlay 'thread-id)))
(mu4e-headers-overlay-set-visibility nil (overlay-get overlay 'thread-id))))))
(defvar mu4e-thread-folding-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map mu4e-headers-mode-map)
(define-key map (kbd "TAB") 'mu4e-headers-toggle-at-point)
(define-key map (kbd "<backtab>") 'mu4e-headers-toggle-fold-all)
map))
;; Install hooks
(defun mu4e-thread-folding-load ()
"Install hooks."
(add-hook 'mu4e-index-updated-hook #'mu4e-headers-mark-threads)
(add-hook 'mu4e-headers-found-hook #'mu4e-headers-mark-threads)
(add-hook 'mu4e-view-mode-hook 'mu4e-headers-mark-threads-no-reset))
;;;###autoload
(define-minor-mode mu4e-thread-folding-mode
"Minor mode for folding threads in mu4e-headers view."
:group 'mu4e-thread-folding
:lighter " Threads"
(if mu4e-thread-folding-mode
(mu4e-thread-folding-load)
(remove-hook 'mu4e-index-updated-hook #'mu4e-headers-mark-threads)
(remove-hook 'mu4e-headers-found-hook #'mu4e-headers-mark-threads)
(remove-hook 'mu4e-view-mode-hook 'mu4e-headers-mark-threads-no-reset)))
(provide 'mu4e-thread-folding)
;;; mu4e-thread-folding.el ends here

View file

@ -0,0 +1,30 @@
import pandas as pd
import os
import re
pd.set_option('display.max_rows', 300)
pd.set_option('display.width', 1000)
pd.set_option('display.max_columns', 500)
pd.options.display.max_colwidth = 100
directory1="/home/misha/Nextcloud/Addresses/data"
for filename in os.listdir(directory1):
path=os.path.join(directory1,filename)
# print(path)
try:
df = pd.read_excel(path)
try:
output = df[['FirstName','MiddleName','LastName','Email']]
print(output)
except:
print(df)
except:
if os.path.isdir(path):
print(f"{path} is a directory")
else:
f = open(path, "r")
for i in f.readlines():
for j in i.split("{"):
if "@" in j:
print(j)

View file

@ -0,0 +1,60 @@
.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-medium {
background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
background-color: rgba(240, 194, 12, 0.6);
}
.marker-cluster-large {
background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
background-color: rgba(241, 128, 23, 0.6);
}
/* IE 6-8 fallback colors */
.leaflet-oldie .marker-cluster-small {
background-color: rgb(181, 226, 140);
}
.leaflet-oldie .marker-cluster-small div {
background-color: rgb(110, 204, 57);
}
.leaflet-oldie .marker-cluster-medium {
background-color: rgb(241, 211, 87);
}
.leaflet-oldie .marker-cluster-medium div {
background-color: rgb(240, 194, 12);
}
.leaflet-oldie .marker-cluster-large {
background-color: rgb(253, 156, 115);
}
.leaflet-oldie .marker-cluster-large div {
background-color: rgb(241, 128, 23);
}
.marker-cluster {
background-clip: padding-box;
border-radius: 20px;
}
.marker-cluster div {
width: 30px;
height: 30px;
margin-left: 5px;
margin-top: 5px;
text-align: center;
border-radius: 15px;
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}
.marker-cluster span {
line-height: 30px;
}

View file

@ -0,0 +1,14 @@
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}
.leaflet-cluster-spider-leg {
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Binary file not shown.

After

(image error) Size: 3.7 KiB

View file

@ -0,0 +1,33 @@
/* #map { */
/* width: 800px; */
/* height: 600px; */
/* border: 1px solid #ccc; */
/* } */
html, body, #map {
height: 100%;
width: 100%;
}
#progress {
display: none;
position: absolute;
z-index: 1000;
left: 400px;
top: 300px;
width: 200px;
height: 20px;
margin-top: -20px;
margin-left: -100px;
background-color: #fff;
background-color: rgba(255, 255, 255, 0.7);
border-radius: 4px;
padding: 2px;
}
#progress-bar {
width: 0;
height: 100%;
background-color: #76A6FC;
border-radius: 4px;
}

View file

@ -0,0 +1,120 @@
.leaflet-container .leaflet-control-search {
position:relative;
float:left;
background:#fff;
color:#1978cf;
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background-color: rgba(255, 255, 255, 0.8);
z-index:1000;
margin-left: 10px;
margin-top: 10px;
}
.leaflet-control-search.search-exp {/*expanded*/
background: #fff;
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
.leaflet-control-search .search-input {
display:block;
float:left;
background: #fff;
border:1px solid #666;
border-radius:2px;
height:22px;
padding:0 20px 0 2px;
margin:4px 0 4px 4px;
}
.leaflet-control-search.search-load .search-input {
background: url('./images/loader.gif') no-repeat center right #fff;
}
.leaflet-control-search.search-load .search-cancel {
visibility:hidden;
}
.leaflet-control-search .search-cancel {
display:block;
width:22px;
height:22px;
position:absolute;
right:28px;
margin:6px 0;
background: url('./images/search-icon.png') no-repeat 0 -46px;
text-decoration:none;
filter: alpha(opacity=80);
opacity: 0.8;
}
.leaflet-control-search .search-cancel:hover {
filter: alpha(opacity=100);
opacity: 1;
}
.leaflet-control-search .search-cancel span {
display:none;/* comment for cancel button imageless */
font-size:18px;
line-height:20px;
color:#ccc;
font-weight:bold;
}
.leaflet-control-search .search-cancel:hover span {
color:#aaa;
}
.leaflet-control-search .search-button {
display:block;
float:left;
width:30px;
height:30px;
background: url('../images/search-icon.png') no-repeat 4px 4px #fff;
border-radius:4px;
}
.leaflet-control-search .search-button:hover {
background: url('./images/search-icon.png') no-repeat 4px -20px #fafafa;
}
.leaflet-control-search .search-tooltip {
position:absolute;
top:100%;
left:0;
float:left;
list-style: none;
padding-left: 0;
min-width:120px;
max-width:720px;
max-height:422px;
box-shadow: 1px 1px 6px rgba(0,0,0,0.4);
background-color: rgba(0, 0, 0, 0.25);
z-index:1010;
overflow-y:auto;
overflow-x:hidden;
cursor: pointer;
}
.leaflet-control-search .search-tip {
margin:2px;
padding:2px 4px;
display:block;
color:black;
background: #eee;
border-radius:.25em;
text-decoration:none;
white-space:nowrap;
vertical-align:center;
}
.leaflet-control-search .search-button:hover {
background-color: #f4f4f4;
}
.leaflet-control-search .search-tip-select,
.leaflet-control-search .search-tip:hover {
background-color: #fff;
}
.leaflet-control-search .search-alert {
cursor:pointer;
clear:both;
font-size:.75em;
margin-bottom:5px;
padding:0 .25em;
color:#e00;
font-weight:bold;
border-radius:.25em;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,331 @@
;; Several variables need to be defined by user:
;; org-mapping-skip-files (list of files that should not be used to build the map)
;; org-mapping-base-folder (the folder in which the folder with the map + data will be placed)
;; org-mapping-image-folder (the folder to put the images in)
;; recoll-search-folder (the folder where recoll will search)
;; spatial-memory-folder (the folder to keep spatial memories)
;; mapping-code-folder
(defun copy-matched-files (str dest-dir)
"Copy files matching a specific pattern in the given string to a destination directory."
(let (start-pos end-pos file-path dest-path)
(while (string-match "\\[\\[.*/\\([^]]*\\.\\(png\\|jpg\\|jpeg\\|mp4\\)\\)\\]\\]" str start-pos)
(setq file-path (match-string 0 str))
;; Remove leading and trailing brackets ('[[' and ']]')
(setq file-path (substring file-path 2 -2))
(setq dest-path (concat (file-name-as-directory dest-dir) (file-name-nondirectory file-path)))
(copy-file file-path dest-path t)
(setq start-pos (match-end 0)))))
(defun copy-matched-files-video (str dest-dir)
"Copy files matching a specific pattern in the string STR to a destination directory DEST-DIR."
(let ((start-pos 0)
file-path dest-path)
(while (string-match "src=\"\\(.*/\\([^]]*\\.\\(png\\|jpg\\|jpeg\\|mov\\|mp4\\)\\)\\)\"" str start-pos)
(setq file-path (match-string 1 str))
(setq dest-path (concat (file-name-as-directory dest-dir) (file-name-nondirectory file-path)))
(copy-file file-path dest-path t)
(setq start-pos (match-end 0)))))
(defun replace-image-path (str)
"Replace image path in a string."
(if (string-match "\\[\\[.*/\\([^]]*\\.\\(png\\|jpg\\|jpeg\\|mp4\\)\\)\\]\\]" str)
(replace-match "[[./../imagesmv/\\1]]" nil nil str)
str))
(defun replace-iframe-path (str)
"Replace iframe path in a string."
(if (string-match "src=\"\\(.*/\\([^]]*\\.\\(png\\|jpg\\|jpeg\\|mov\\|mp4\\)\\)\\)\"" str)
(replace-match "src=\"./../imagesmv/\\2\"" nil nil str)
str))
;; get contents from org element
(defun org-mapping-get-contents (element)
(let* ((beg (org-element-property :contents-begin element))
(end (org-element-property :contents-end element))
(content (buffer-substring-no-properties beg end))
(content (string-join (cdr (split-string content ":END:")) "")))
(string-trim content "\n")))
(defun org-mapping-notes-build-map ()
(interactive)
;; Initialize variables
(let* ((total '()) ;; List of all the locations
(taglist '()) ;; List of all the tags
(org-html-postamble nil) ;; Set the postamble to nil
(code-folder mapping-code-folder)
(length-list (length (seq-uniq (butlast (cdr (split-string (shell-command-to-string (format "recollq -b \"org-coor\" | grep -i \"%s\" | grep -v yankring | grep -v bash_history | cut -c8-" recoll-search-folder)) "\n")))))))
(setq count 0)
;; Map over all the org files
(mapcar (lambda (file)
(setq count (1+ count))
(message "%s/%s" count length-list)
;; only turn tag inheritance on for spatial_memory.org
(if (string= file spatial-memory-folder)
(setq org-use-tag-inheritance t)
(setq org-use-tag-inheritance nil))
;;(message (format "%s" file))
(print org-use-tag-inheritance)
;; Create a new buffer for each file
(with-temp-buffer
(org-mode)
(when (not (member file org-mapping-skip-files)) ;; Skip files that are in the skip list
(insert-file-contents file)
(setq sub-count 0)
;; Look for org-coor tag in the file
;;(message (format "fileee: %s" file))
(while (search-forward "org-coor" nil t)
(org-previous-visible-heading 1) ;; Go to previous heading
;;(message (format "test: %s" (org-element-property :title (org-element-at-point)))) ;; Display the title of the heading
(let* ((elt (org-element-at-point))
(title (org-element-property :title elt))
(org-export-with-toc nil)
(org-export-with-section-numbers nil)
(tag (car (org-get-tags))) ;; Get the tag of the heading
;;(message (format "%s" (org-entry-get nil "org-coor" elt)))
(coor (split-string (org-entry-get nil "org-coor" elt) ",")) ;; Get the coordinates of the heading
(content (org-mapping-get-contents elt)) ;; Get the contents of the heading
(content2 content)
(content (replace-image-path content))
(content (replace-iframe-path content))
(content (format "* %s\n%s" title content)) ;; Format the contents of the heading
;;(message (format "%s" content))
(link (format "<br><a href=\\\"%s\\\">%s</a>" file (file-name-nondirectory file))) ;; Create a link to the file
(content_html (string-replace "\n" "" (string-replace "\"" "\\\"" (cl-letf (((symbol-function 'y-or-n-p) (lambda (&rest args) t))) (org-msg-export-as-html content))))) ;; Convert contents to HTML (MV the cl-letf setup is to automatically say yes to the y-or-n-p that is part of the org-msg-export-as-html function (which otherwise complains that the image does not exist).
(output (format "[%s,%s,\"%s<br>tag: %s<br>%s\",\"%s\"]" (nth 0 coor) (nth 1 coor) content_html tag link tag)) ;; Create output string with coordinates, contents, tag and link
)
(copy-matched-files content2 org-mapping-image-folder)
(copy-matched-files-video content2 org-mapping-image-folder)
(org-next-visible-heading 1) ;; Go to next heading
(push output total) ;; Add output string to list of locations
(push tag taglist) ;; Add tag to list of tags
)))))
(seq-uniq (butlast (cdr (split-string (shell-command-to-string (format "recollq -b \"org-coor\" | grep -i \"%s\" | grep -v yankring | grep -v bash_history | cut -c8-" recoll-search-folder)) "\n")))))
;; Delete old directory and copy new directory
(when (file-exists-p (format "%s/org-mapping-notes-docs" org-mapping-base-folder))
(delete-directory (format "%s/org-mapping-notes-docs" org-mapping-base-folder) t))
(copy-directory (format "%s/org-mapping-notes-docs" code-folder) (format "%s/" org-mapping-base-folder) t)
;; Write all locations to data.js file
(write-region (format "var points = [\n%s\n];" (string-join total ",")) nil (format "%s/org-mapping-notes-docs/data.js" org-mapping-base-folder))
;; Create HTML file
(let* ((firsttags (delq nil (cl-delete-duplicates taglist :test 'string=)))
;; (let* ((firsttags (delq nil (delete-dups taglist :test 'string=)))
(map1 "<!DOCTYPE html>
<html>
<head>
<title>Org-mapping-notes</title>
<link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet@1.0.3/dist/leaflet.css\" integrity=\"sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ==\" crossorigin=\"\" />
<script src=\"https://unpkg.com/leaflet@1.0.3/dist/leaflet-src.js\" integrity=\"sha512-WXoSHqw/t26DszhdMhOXOkI7qCiv5QWXhH9R7CgvgZMHz1ImlkVQ3uNsiQKu5wwbbxtPzFXd1hK4tzno2VqhpA==\" crossorigin=\"\"></script>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<link rel=\"stylesheet\" href=\"screen.css\" />
<link rel=\"stylesheet\" href=\"./dist/MarkerCluster.css\" />
<link rel=\"stylesheet\" href=\"./dist/MarkerCluster.Default.css\" />
<script src=\"./dist/leaflet.markercluster-src.js\"></script>
<script src=\"./data.js\"></script>
<script src=\"./src/leaflet-search.js\"></script>
<link rel=\"stylesheet\" href=\"./src/leaflet-search.css\" />
<link rel=\"stylesheet\" href=\"style.css\" />
</head>
<body>
<div id=\"map\"></div>
<script type=\"text/javascript\">
function getColor(stype) {
switch (stype) {")
(map2 "
}
}
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, Points &copy 2012 LINZ'
}),
latlng = L.latLng(0, 0);
var map = L.map('map', {center: latlng, zoom: 2, layers: [tiles]});
var markers = L.markerClusterGroup({ chunkedLoading: true });
var controlSearch = new L.Control.Search({
layer: markers,
initial: false,
maxHeight: 300,
zoom: 17,
marker: false
});
map.addControl( controlSearch );
for (var i = 0; i < points.length; i++) {
var a = points[i];
var title = a[2];
var marker = L.circleMarker(L.latLng(a[0], a[1]),
{title: title,
radius: 15,
/* fillColor: '#339966', */
fillColor: getColor(a[3]),
color: '#000',
weight: 1,
opacity: 1,
fillOpacity: 0.4});
marker.bindPopup(title,{maxHeight: 300, maxWidth: 450});
markers.addLayer(marker);
}
map.addLayer(markers);
</script>
</body>
</html>")
(map3 "
}
}
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, Points &copy 2012 LINZ'
}),
latlng = L.latLng(0, 0);
var map = L.map('map', {center: latlng, zoom: 2, layers: [tiles]});
var markers = L.markerClusterGroup({ chunkedLoading: true });
var controlSearch = new L.Control.Search({
layer: markers,
initial: false,
maxHeight: 300,
zoom: 17,
marker: false
});
map.addControl( controlSearch );
for (var i = 0; i < points.length; i++) {
var a = points[i];
var title = a[2];
var marker = L.circleMarker(L.latLng(a[0], a[1]),
{title: title,
radius: 15,
/* fillColor: '#339966', */
fillColor: getColor(a[3]),
color: '#000',
weight: 1,
opacity: 1,
fillOpacity: 0.4});
marker.bindPopup(title,{maxHeight: 300, maxWidth: 250});
markers.addLayer(marker);
}
function onLocationFound(e) {
const radius = e.accuracy / 2;
const locationMarker = L.marker(e.latlng).addTo(map)
.bindPopup(`You are within ${radius} meters from this point`).openPopup();
const locationCircle = L.circle(e.latlng, radius).addTo(map);
}
function onLocationError(e) {
alert(e.message);
}
map.on('locationfound', onLocationFound);
map.on('locationerror', onLocationError);
map.addLayer(markers);
map.locate({setView: true, maxZoom: 2});
map.addLayer(markers);
</script>
</body>
</html>")
(map4 "
}
}
var tiles = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, Points &copy 2012 LINZ'
}),
latlng = L.latLng(0, 0);
var map = L.map('map', {center: latlng, zoom: 2, layers: [tiles]});
var markers = L.markerClusterGroup({ chunkedLoading: true });
var controlSearch = new L.Control.Search({
layer: markers,
initial: false,
maxHeight: 300,
zoom: 17,
marker: false
});
map.addControl( controlSearch );
for (var i = 0; i < points.length; i++) {
var a = points[i];
var title = a[2];
var marker = L.circleMarker(L.latLng(a[0], a[1]),
{title: title,
radius: 15,
/* fillColor: '#339966', */
fillColor: getColor(a[3]),
color: '#000',
weight: 1,
opacity: 1,
fillOpacity: 0.4});
marker.bindPopup(title,{maxHeight: 300, maxWidth: 450});
markers.addLayer(marker);
}
map.addLayer(markers);
</script>
</body>
</html>")
;; Define the list of colors
(colors '("#FF0000" "#00FF00" "#0000FF" "#FFFF00" "#FF00FF" "#00FFFF" "#FFA500" "#800080" "#008000" "#800000"))
;; Create a string of `case` statements that return the next color in the `colors` list
(in-between (mapconcat
(lambda (in)
(format "case '%s':\nreturn '%s';" in (pop colors)))
firsttags "\n")))
;; Write the resulting string to a file located at "org-mapping-notes-docs/map.html"
(write-region (format "%s\n%s\n%s" map1 in-between map2) nil (format "%s/org-mapping-notes-docs/map.html" org-mapping-base-folder))
(write-region (format "%s\n%s\n%s" map1 in-between map3) nil (format "%s/org-mapping-notes-docs/map_location.html" org-mapping-base-folder))
(write-region (format "%s\n%s\n%s" map1 in-between map4) nil (format "%s/org-mapping-notes-docs/map_topo-map.html" org-mapping-base-folder))
))
(setq org-use-tag-inheritance nil)
)

View file

@ -0,0 +1,115 @@
(defun org-noter-pdftools-embed-org-note-to-pdf ()
"Embed a org subtree to its corresponding PDF annotation."
(interactive)
(org-noter--with-valid-session
(unless (equal (selected-window) (org-noter--get-notes-window))
(error "You should use this command in an org-noter note buffer"))
(save-excursion
(if (not (string-equal "*" (nth 1 (split-string (thing-at-point 'line) "")))) (org-previous-visible-heading 1))
(let* ((org-id (org-id-get))
(edges2 (car (last (split-string org-id "-"))))
(page (string-to-number (car (split-string (nth 1 (split-string (org-element-property :NOTER_PAGE (org-element-at-point)) "::")) "++")))))
(other-window 1)
(let ((annot-id (mapc
(lambda (arg) (if (string-equal edges2 (mapconcat #'number-to-string (alist-get 'edges arg) ":"))
(setq annot-id2 (alist-get 'id arg))))
(pdf-annot-getannots page))))
(other-window 1)
(let* ((annot-id annot-id2)
note)
(setq kr kill-ring)
(org-copy-subtree nil nil nil t)
(setq note (car kill-ring))
(print (format "%s" annot-id))
(setq kill-ring kr)
(with-selected-window
(org-noter--get-doc-window)
(print (format "%s" annot-id))
(let ((annot (pdf-annot-getannot (intern (format "%s" annot-id)))))
(with-current-buffer (pdf-annot-edit-contents-noselect annot)
(insert (string-join (cdr (split-string note ":END:")) ""))
;; (insert note)
(pdf-annot-edit-contents-finalize t)))
(save-buffer))))))))
(defun org-noter-pdftools-embed-org-note-to-pdf ()
"Embed a org subtree to its corresponding PDF annotation."
(interactive)
(org-noter--with-valid-session
(unless (equal (selected-window) (org-noter--get-notes-window))
(error "You should use this command in an org-noter note buffer"))
(save-excursion
(if (not (string-equal "*" (nth 1 (split-string (thing-at-point 'line) "")))) (org-previous-visible-heading 1))
(let* ((org-id (org-id-get))
(edges2 (car (last (split-string org-id "-"))))
(page (string-to-number (car (split-string (nth 1 (split-string (org-element-property :NOTER_PAGE (org-element-at-point)) "::")) "++")))))
(other-window 1)
(let ((annot-id (mapc
(lambda (arg) (if (string-equal edges2 (mapconcat #'number-to-string (alist-get 'edges arg) ":"))
(setq annot-id2 (alist-get 'id arg))))
(pdf-annot-getannots page))))
(other-window 1)
(let* ((annot-id annot-id2)
note)
(setq kr kill-ring)
(org-copy-subtree nil nil nil t)
(setq note (car kill-ring))
(print (format "%s" annot-id))
(setq kill-ring kr)
(with-selected-window
(org-noter--get-doc-window)
(print (format "%s" annot-id))
(let ((annot (pdf-annot-getannot (intern (format "%s" annot-id)))))
(with-current-buffer (pdf-annot-edit-contents-noselect annot)
(insert (string-join (cdr (split-string note ":END:")) ""))
;; (insert note)
;; (delete-region 1 (point-max))
(pdf-annot-edit-contents-finalize t)))
(save-buffer))))))))
(defun org-noter-pdftools-embed-org-note-to-pdf-delete ()
"Embed a org subtree to its corresponding PDF annotation."
(interactive)
(org-noter--with-valid-session
(unless (equal (selected-window) (org-noter--get-notes-window))
(error "You should use this command in an org-noter note buffer"))
(save-excursion
(if (not (string-equal "*" (nth 1 (split-string (thing-at-point 'line) "")))) (org-previous-visible-heading 1))
(let* ((org-id (org-id-get))
(edges2 (car (last (split-string org-id "-"))))
(page (string-to-number (car (split-string (nth 1 (split-string (org-element-property :NOTER_PAGE (org-element-at-point)) "::")) "++")))))
(other-window 1)
(let ((annot-id (mapc
(lambda (arg) (if (string-equal edges2 (mapconcat #'number-to-string (alist-get 'edges arg) ":"))
(setq annot-id2 (alist-get 'id arg))))
(pdf-annot-getannots page))))
(other-window 1)
(let* ((annot-id annot-id2)
note)
(setq kr kill-ring)
(org-copy-subtree nil nil nil t)
(setq note (car kill-ring))
(print (format "%s" annot-id))
(setq kill-ring kr)
(with-selected-window
(org-noter--get-doc-window)
(print (format "%s" annot-id))
(let ((annot (pdf-annot-getannot (intern (format "%s" annot-id)))))
(with-current-buffer (pdf-annot-edit-contents-noselect annot)
;; (insert (string-join (cdr (split-string note ":END:")) ""))
;; (insert note)
(delete-region 1 (point-max))
(pdf-annot-edit-contents-finalize t)))
(save-buffer))))))))
(defun mv/org-noter-pdftools-embed-all-org-note-to-pdf ()
(interactive)
(org-noter--with-valid-session
(with-selected-window (org-noter--get-notes-window)
(save-excursion
(org-map-entries #'org-noter-pdftools-embed-org-note-to-pdf-delete "ID={:}")
(org-map-entries #'org-noter-pdftools-embed-org-note-to-pdf "ID={:}")))))

View file

@ -0,0 +1,711 @@
;;; org-noter-pdftools.el --- Integration between org-pdftools and org-noter
;; Copyright (C) 2020 Alexander Fu Xi
;; Author: Alexander Fu Xi <fuxialexander@gmail.com>
;; Maintainer: Alexander Fu Xi <fuxialexnader@gmail.com>
;; Homepage: https://github.com/fuxialexander/org-pdftools
;; Version: 1.0 (MV)
;; Keywords: convenience
;; Package-Requires: ((emacs "26.1") (org "9.4") (pdf-tools "0.8") (org-pdftools "1.0") (org-noter "1.4.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Add integration between org-pdftools and org-noter.
;;; Code:
(require 'org-id)
(require 'org-pdftools)
(require 'org-noter)
(require 'image-mode)
(declare-function pdf-info-editannot "ext:pdf-info")
(declare-function pdf-annot-add-text-annotation "ext:pdf-annot")
(declare-function pdf-annot-get-id "ext:pdf-annot")
(defcustom org-noter-pdftools-markup-pointer-function 'pdf-annot-add-highlight-markup-annotation
"Color for markup pointer annotations.
Can be one of highlight/underline/strikeout/squiggly."
:group 'org-noter
:type 'function)
(defcustom org-noter-pdftools-path-generator #'abbreviate-file-name
"Translate your PDF file path the way you like. Take buffer-file-name as the argument."
:group 'org-pdftools
:type 'function)
(defcustom org-noter-pdftools-markup-pointer-color "#A9A9A9"
"Color for markup pointer annotations."
:group 'org-noter
:type 'string)
(defcustom org-noter-pdftools-markup-pointer-opacity 1.0
"Color for markup pointer annotations."
:group 'org-noter
:type 'float)
(defcustom org-noter-pdftools-free-pointer-icon "Circle"
"Color for free pointer annotations. Refer to `pdf-annot-standard-text-icons`."
:group 'org-noter
:type 'string)
(defcustom org-noter-pdftools-free-pointer-color "#FFFFFF"
"Color for free pointer annotations."
:group 'org-noter
:type 'string)
(defcustom org-noter-pdftools-free-pointer-opacity 1.0
"Color for free pointer annotations."
:group 'org-noter
:type 'float)
(defcustom org-noter-pdftools-use-pdftools-link-location t
"When non-nil, org-pdftools link is used instead of location-cons when inserting notes."
:group 'org-noter
:type 'boolean)
(defcustom org-noter-pdftools-use-org-id t
"When non-nil, an org-id is generated for each heading for linking with PDF annotations and record entry parents."
:group 'org-noter
:type 'boolean)
(defcustom org-noter-pdftools-export-to-pdf t
"TODO: Whether you want to export the org notes to pdf annotation contents.
To use this, `org-noter-pdftools-use-org-id' has to be t."
:group 'org-noter
:type 'boolean)
(defcustom org-noter-pdftools-export-to-pdf-with-structure t
"TODO: Whether you want to export the org notes to pdf annotation contents.
To use this, `org-noter-pdftools-use-org-id' has to be t."
:group 'org-noter
:type 'boolean)
(defcustom org-noter-pdftools-use-unique-org-id t
"When non-nil, an org-id is generated for each heading for linking with PDF annotations and record entry parents."
:group 'org-noter
:type 'boolean)
(defcustom org-noter-pdftools-insert-content-heading t
"When non-nil, insert a \"Content\" heading above the content of an annotation (underline, highlight)"
:group 'org-noter
:type 'boolean)
(defcustom org-noter-pdftools-insert-comment-heading t
"When non-nil, insert a \"Content\" heading above the content of an annotation (underline, highlight)"
:group 'org-noter
:type 'boolean)
(cl-defstruct org-noter-pdftools--location
path page height annot-id search-string original-property)
(defun org-noter-pdftools--location-link-p (location)
"Check whether LOCATION is a org-pdftools link."
(and location
(stringp location)
(or
(string-prefix-p
(concat "[[" org-pdftools-link-prefix ":")
location)
(string-prefix-p
(concat org-pdftools-link-prefix ":")
location))))
(defun org-noter-pdftools--location-cons-to-link (location)
"Convert LOCATION cons to link."
(cond ((consp location)
(concat
"::"
(number-to-string
(car location))
"++"
(format "%.2f" (cdr location))))
((integerp location)
(concat
"::"
(number-to-string
(car location))))))
(defun org-noter-pdftools--location-link-to-cons (location)
"Convert a org-pdftools link to old LOCATION cons."
(cons (org-noter-pdftools--location-page location) (or (org-noter-pdftools--location-height location) 0.0)))
;; --------------------------------------------------------------------------------
;; NOTE(nox): Interface
(defun org-noter-pdftools--check-link (property)
"Interface for checking PROPERTY link."
(org-noter-pdftools--location-link-p property))
(defun org-noter-pdftools--parse-link (property)
"Interface for parse PROPERTY link."
(when (org-noter-pdftools--location-link-p property)
(setq property (string-trim property "\\[\\[" "\\]\\]"))
(let ((link-regexp (concat "\\(.*\\)::\\([0-9]*\\)\\(\\+\\+\\)?\\([[0-9]\\.*[0-9]*\\)?\\(;;\\|"
(regexp-quote org-pdftools-search-string-separator)
"\\)?\\(.*\\)?")))
(string-match link-regexp property)
(let ((path (match-string 1 property))
(page (match-string 2 property))
(height (match-string 4 property))
annot-id search-string)
(condition-case nil
(cond ((string-equal (match-string 5 property) ";;")
(setq annot-id (match-string 6 property)))
((string-equal (match-string 5 property) org-pdftools-search-string-separator)
(setq search-string (replace-regexp-in-string "%20" " " (match-string 6 property)))))
(error nil))
(make-org-noter-pdftools--location
:path path
:page (and page (string-to-number page))
:height (and height (string-to-number height))
:annot-id annot-id
:search-string search-string
:original-property property)))))
(defun org-noter-pdftools--pretty-print-location (location)
"Function for print the LOCATION link."
(org-noter--with-valid-session
(if (memq (org-noter--session-doc-mode session) '(doc-view-mode pdf-view-mode))
(let ((loc (if (org-noter-pdftools--location-p location)
location
(org-noter-pdftools--parse-link location))))
(concat "[["
(org-noter-pdftools--location-original-property loc)
"]]"))
nil)))
(defun org-noter-pdftools--convert-to-location-cons (location)
"Function for converting the LOCATION link to cons."
(if (and location (consp location))
location
(let ((loc (if (org-noter-pdftools--location-p location)
location
(org-noter-pdftools--parse-link location))))
(org-noter-pdftools--location-link-to-cons loc))))
(defun org-noter-pdftools--doc-goto-location (mode location &optional window)
"Goto LOCATION in the corresponding MODE."
(when (and (eq mode 'pdf-view-mode) (org-noter-pdftools--location-p location))
(when (org-noter-pdftools--location-page location)
(pdf-view-goto-page (org-noter-pdftools--location-page location)))
(when (org-noter-pdftools--location-height location)
(image-set-window-vscroll
(round (/ (* (org-noter-pdftools--location-height location) (cdr (pdf-view-image-size)))
(frame-char-height)))))
(when (org-noter-pdftools--location-annot-id location)
(pdf-annot-show-annotation (pdf-info-getannot (org-noter-pdftools--location-annot-id location)) t))
(when (org-noter-pdftools--location-search-string location)
(isearch-mode t)
(isearch-yank-string (org-noter-pdftools--location-search-string location)))
t))
(defun org-noter-pdftools--note-after-tipping-point (point location view)
"Call `org-noter--note-after-tipping-point' relative to POINT based on LOCATION and VIEW."
(when (org-noter-pdftools--location-p location)
(cons t (org-noter--note-after-tipping-point point (org-noter-pdftools--location-link-to-cons location) view))))
(defun org-noter-pdftools--relative-position-to-view (location view)
"Get relative position based on LOCATION and VIEW."
(when (org-noter-pdftools--location-p location)
(org-noter--relative-position-to-view (org-noter-pdftools--location-link-to-cons location) view)))
(defun org-noter-pdftools--get-precise-info (mode)
"Get precise info from MODE."
(when (eq mode 'pdf-view-mode)
(let ((org-pdftools-free-pointer-icon org-noter-pdftools-free-pointer-icon)
(org-pdftools-free-pointer-color org-noter-pdftools-free-pointer-color)
(org-pdftools-free-pointer-opacity org-noter-pdftools-free-pointer-opacity)
(org-pdftools-markup-pointer-color org-noter-pdftools-markup-pointer-color)
(org-pdftools-markup-pointer-opacity org-noter-pdftools-markup-pointer-opacity)
(org-pdftools-markup-pointer-function org-noter-pdftools-markup-pointer-function))
(org-noter-pdftools--parse-link (org-pdftools-get-link)))))
(defun org-noter-pdftools--doc-approx-location (mode precise-info force-new-ref)
"Get approximate location in MODE buffer based on PRECISE-INFO and FORCE-NEW-REF."
(org-noter--with-valid-session
(when (eq mode 'pdf-view-mode)
(cond ((or (numberp precise-info) (not precise-info))
(org-noter-pdftools--parse-link
(concat org-pdftools-link-prefix ":" (expand-file-name (org-noter--session-property-text session)) "::"
(number-to-string (image-mode-window-get 'page))
(when precise-info (concat "++" (number-to-string precise-info))))))
((org-noter-pdftools--location-p precise-info) precise-info)
((eq precise-info 'interactive)
(when force-new-ref
(setf (gv-deref force-new-ref) t))
(org-noter-pdftools--get-precise-info mode))
(t (error "Invalid pdftools precise-info case: %s" precise-info))))))
(defun org-noter-pdftools--insert-heading ()
"Insert heading in the `org-noter' org document."
(let* ((location-property (org-entry-get nil org-noter-property-note-location)))
(when location-property
(if (string-suffix-p "]]" location-property)
(setq location-property (substring location-property 0 -2)))
(when (string-match ".*;;\\(.*\\)" location-property)
(org-noter--with-valid-session
(let ((id (match-string 1 location-property)))
(if org-noter-pdftools-use-org-id
(org-entry-put nil "ID"
(if org-noter-pdftools-use-unique-org-id
(concat
(org-noter--session-property-text session)
"-"
id)
id)))))))))
(dolist (pair '((org-noter--check-location-property-hook . org-noter-pdftools--check-link)
(org-noter--parse-location-property-hook . org-noter-pdftools--parse-link)
(org-noter--pretty-print-location-hook . org-noter-pdftools--pretty-print-location)
(org-noter--convert-to-location-cons-hook . org-noter-pdftools--convert-to-location-cons)
(org-noter--doc-goto-location-hook . org-noter-pdftools--doc-goto-location)
(org-noter--note-after-tipping-point-hook . org-noter-pdftools--note-after-tipping-point)
(org-noter--relative-position-to-view-hook . org-noter-pdftools--relative-position-to-view)
(org-noter--get-precise-info-hook . org-noter-pdftools--get-precise-info)
(org-noter--doc-approx-location-hook . org-noter-pdftools--doc-approx-location)
(org-noter-insert-heading-hook . org-noter-pdftools--insert-heading)))
(add-hook (car pair) (cdr pair)))
;; --------------------------------------------------------------------------------
;; NOTE(nox): User commands
(defun org-noter-pdftools-convert-old-org-heading ()
"Covert an old org heading to a new one for compatiblility."
(interactive)
(org-noter--with-valid-session
(cond ((eq (org-noter--session-doc-mode
session)
'pdf-view-mode)
(let* ((document-property (org-noter--session-property-text
session)))
(let* ((location (org-noter--parse-location-property
(org-entry-get
nil
org-noter-property-note-location)))
(path document-property)
(page (if (consp location)
(car location)
location))
(height (if (consp location)
(cdr location)
0.0))
(pos `(0 . ,(round
(*
(cdr (with-current-buffer
(org-noter--session-doc-buffer
session)
(pdf-view-image-size)))
height))))
(annot-id (symbol-name
(pdf-annot-get-id
(save-excursion
(with-selected-window
(org-noter--get-doc-window)
(pdf-view-goto-page page)
(funcall-interactively
#'pdf-annot-add-text-annotation
pos
org-pdftools-free-pointer-icon
`((color . ,org-pdftools-free-pointer-color)
(opacity . ,org-pdftools-free-pointer-opacity)))))))))
(org-entry-put
nil
org-noter-property-note-location
(concat
"[["
org-pdftools-link-prefix
":"
path
(org-noter-pdftools--location-cons-to-link
location)
";;"
annot-id
"]]"))
(when org-noter-pdftools-use-org-id
(org-entry-put
nil
"ID"
(if org-noter-pdftools-use-unique-org-id
(concat
document-property
"-"
annot-id)
annot-id)))
(when org-noter-pdftools-export-to-pdf
(let* ((content (if (and (> (org-current-level) 2)
org-noter-pdftools-export-to-pdf-with-structure)
(let ((parent-id (save-excursion
(org-up-heading-safe)
(org-id-get))))
(if parent-id
(concat
"#+PROPERTY: PARENT "
parent-id
"\n"
(save-excursion
(org-back-to-heading nil)
(buffer-substring-no-properties
(point)
(org-end-of-subtree nil t))))))
(save-excursion
(org-back-to-heading nil)
(buffer-substring-no-properties
(point)
(org-end-of-subtree nil t))))))
(with-selected-window
(org-noter--get-doc-window)
(pdf-info-editannot
(intern annot-id)
`((contents . ,content)))))))))
(t
(error
"This command is only supported on PDF Tools")))))
(defun org-noter-pdftools-convert-old-notes ()
"Convert old notes (location cons based) to new format (link based)."
(interactive)
(org-noter--with-valid-session
(goto-char (point-min))
(when (org-before-first-heading-p)
(org-next-visible-heading 1))
(while (not (eq (point) (point-max)))
(org-next-visible-heading 1)
(goto-char (point-at-eol))
(let ((prop (org-entry-get
nil
org-noter-property-note-location)))
(if (and prop
(not (string-prefix-p
org-pdftools-link-prefix ":"
prop)))
(call-interactively
#'org-noter-pdftools-convert-old-org-heading))))))
(defun org-noter-pdftools-jump-to-note2 (a)
"Jump from a PDF annotation A to the corresponding org heading."
(interactive (list
(with-selected-window
(org-noter--get-doc-window)
(pdf-annot-read-annotation
"Left click the annotation "))))
(unless org-noter-pdftools-use-org-id
"You have to enable `org-noter-pdftools-use-org-id'!")
(org-noter--with-valid-session
(pdf-annot-show-annotation a t)
(let ((edges (string-join
(mapcar #'number-to-string (alist-get 'edges a))
":"))
(pagenum (alist-get 'page a)))
(select-window
(org-noter--get-notes-window))
(goto-char (point-min))
(search-forward (format "::%s++" pagenum))
(search-forward edges)
(reposition-window)
)))
(defun org-noter-pdftools-jump-to-note (a)
(org-noter-pdftools-jump-to-note2 a)
(delay 0.5)
(lambda () (run-with-timer 0.5 nil #'reposition-window))
)
;; TODO(nox): Implement interface for skeleton creation
(defun org-noter-pdftools-create-skeleton ()
"Create notes skeleton with the PDF outline or annotations.
Only available with PDF Tools."
(interactive)
(org-noter--with-valid-session
(cond
((eq (org-noter--session-doc-mode session) 'pdf-view-mode)
(let* ((ast (org-noter--parse-root))
(top-level (org-element-property :level ast))
(options '(("Outline" . (outline))
("Annotations" . (annots))
("Both" . (outline annots))))
answer output-data)
(with-current-buffer (org-noter--session-doc-buffer session)
(setq answer (assoc (completing-read "What do you want to import? " options nil t) options))
(when (memq 'outline answer)
(dolist (item (pdf-info-outline))
(let ((type (alist-get 'type item))
(page (alist-get 'page item))
(depth (alist-get 'depth item))
(title (alist-get 'title item))
(top (alist-get 'top item))
pdftools-link path)
(when (and (eq type 'goto-dest)
(> page 0))
(when org-noter-pdftools-use-pdftools-link-location
(setq path
(funcall org-noter-pdftools-path-generator (buffer-file-name)))
(if title
(setq pdftools-link
(concat
org-pdftools-link-prefix ":"
path
"::"
(number-to-string page)
"++"
(number-to-string top)
org-pdftools-search-string-separator
(replace-regexp-in-string
" "
"%20"
title)))
(setq pdftools-link
(concat
org-pdftools-link-prefix ":"
path
"::"
(number-to-string page)
"++"
(number-to-string top)))))
(push
(vector
title
(if org-noter-pdftools-use-pdftools-link-location pdftools-link
(cons page top))
(1+ depth)
nil)
output-data)))))
(when (memq 'annots answer)
(let ((possible-annots (list '("Highlights" . highlight)
'("Underlines" . underline)
'("Squigglies" . squiggly)
'("Text notes" . text)
'("Strikeouts" . strike-out)
'("Links" . link)
'("ALL" . all)))
chosen-annots insert-contents pages-with-links)
(while (> (length possible-annots) 1)
(let* ((chosen-string (completing-read "Which types of annotations do you want? "
possible-annots nil t))
(chosen-pair (assoc chosen-string possible-annots)))
(cond ((eq (cdr chosen-pair) 'all)
(dolist (annot possible-annots)
(when (and (cdr annot) (not (eq (cdr annot) 'all)))
(push (cdr annot) chosen-annots)))
(setq possible-annots nil))
((cdr chosen-pair)
(push (cdr chosen-pair) chosen-annots)
(setq possible-annots (delq chosen-pair possible-annots))
(when (= 1 (length chosen-annots)) (push '("DONE") possible-annots)))
(t
(setq possible-annots nil)))))
(setq insert-contents (y-or-n-p "Should we insert the annotations contents? "))
(dolist (item (pdf-info-getannots))
(let* ((type (alist-get 'type item))
(page (alist-get 'page item))
(edges (or (org-noter--pdf-tools-edges-to-region (alist-get 'markup-edges item))
(alist-get 'edges item)))
(top (nth 1 edges))
(item-subject (alist-get 'subject item))
(item-contents (alist-get 'contents item))
(id (symbol-name (alist-get 'id item)))
name contents pdftools-link path)
(when org-noter-pdftools-use-pdftools-link-location
(setq path (funcall org-noter-pdftools-path-generator (buffer-file-name)))
(setq pdftools-link (concat org-pdftools-link-prefix ":" path "::"
(number-to-string page) "++"
(number-to-string top) ";;"
id)))
(when (and (memq type chosen-annots) (> page 0))
(if (eq type 'link)
(cl-pushnew page pages-with-links)
(setq name (cond ((eq type 'highlight) "Highlight")
((eq type 'underline) "Underline")
((eq type 'squiggly) "Squiggly")
((eq type 'text) "Text note")
((eq type 'strike-out) "Strikeout")))
(when insert-contents
(setq contents (cons (pdf-info-gettext page edges)
(and (or (and item-subject (> (length item-subject) 0))
(and item-contents (> (length item-contents) 0)))
(concat (or item-subject "")
(if (and item-subject item-contents) "\n" "")
(or item-contents ""))))))
(push (vector (format "%s on page %d" name page) (if org-noter-pdftools-use-pdftools-link-location
pdftools-link
(cons page top)) 'inside contents)
output-data)))))
(dolist (page pages-with-links)
(let ((links (pdf-info-pagelinks page))
type)
(dolist (link links)
(setq type (alist-get 'type link))
(unless (eq type 'goto-dest) ;; NOTE(nox): Ignore internal links
(let* ((edges (alist-get 'edges link))
(title (alist-get 'title link))
(top (nth 1 edges))
(target-page (alist-get 'page link))
target heading-text pdftools-link path)
(when org-noter-pdftools-use-pdftools-link-location
(setq path
(funcall org-noter-pdftools-path-generator (buffer-file-name)))
(setq pdftools-link (concat org-pdftools-link-prefix ":" path "::"
(number-to-string page) "++"
(number-to-string top))))
(unless (and title (> (length title) 0)) (setq title (pdf-info-gettext page edges)))
(cond
((eq type 'uri)
(setq target (alist-get 'uri link)
heading-text (format "Link on page %d: [[%s][%s]]" page target title)))
((eq type 'goto-remote)
(setq target (concat "file:" (alist-get 'filename link))
heading-text (format "Link to document on page %d: [[%s][%s]]" page target title))
(when target-page
(setq heading-text (concat heading-text (format " (target page: %d)" target-page)))))
(t (error "Unexpected link type")))
(push
(vector
heading-text
(if org-noter-pdftools-use-pdftools-link-location
pdftools-link
(cons page top))
'inside
nil)
output-data))))))))
(when output-data
(if (memq 'annots answer)
(setq output-data
(sort output-data
(lambda (e1 e2)
(or (not (aref e1 1))
(and (aref e2 1)
(org-noter--compare-locations '< (aref e1 1) (aref e2 1)))))))
(setq output-data (nreverse output-data)))
(push (vector "Skeleton" nil 1 nil) output-data)))
(with-current-buffer (org-noter--session-notes-buffer session)
;; NOTE(nox): org-with-wide-buffer can't be used because we want to reset the
;; narrow region to include the new headings
(widen)
(save-excursion
(goto-char (org-element-property :end ast))
(let (last-absolute-level
title location relative-level contents
level)
(dolist (data output-data)
(setq title (aref data 0)
location (aref data 1)
relative-level (aref data 2)
contents (aref data 3))
(if (symbolp relative-level)
(setq level (1+ last-absolute-level))
(setq last-absolute-level (+ top-level relative-level)
level last-absolute-level))
(org-noter--insert-heading level title nil location t)
(when (car contents)
(when org-noter-pdftools-insert-content-heading
(org-noter--insert-heading (1+ level) "Contents" nil t))
(insert (car contents)))
(when (cdr contents)
(when org-noter-pdftools-insert-comment-heading
(org-noter--insert-heading (1+ level) "Comment" nil t))
(insert (cdr contents)))))
(setq ast (org-noter--parse-root))
(org-noter--narrow-to-root ast)
(goto-char (org-element-property :begin ast))
(outline-hide-subtree)
(org-show-children 2)))))
(t (error "This command is only supported on PDF Tools")))))
(defun org-noter-pdftools-embed-org-note-to-pdf ()
"Embed a org subtree to its corresponding PDF annotation."
(interactive)
(org-noter--with-valid-session
(unless (equal (selected-window) (org-noter--get-notes-window))
(error "You should use this command in an org-noter note buffer"))
(let* ((org-id (org-id-get)))
(unless (and (string-match ".*\\(annot-.*-.*\\)" org-id)
org-noter-pdftools-use-org-id
org-noter-pdftools-use-pdftools-link-location)
(error "This can only be run on an org heading with a valid org-pdftools annotation ID.
Please also make sure `org-noter-pdftools-use-org-id' and `org-noter-pdftools-use-pdftools-link-location' are enabled"))
(let* ((annot-id (match-string 1 org-id))
note)
(setq kr kill-ring)
(org-copy-subtree nil nil nil t)
(setq note (car kill-ring))
(setq kill-ring kr)
(with-selected-window
(org-noter--get-doc-window)
(let ((annot (pdf-annot-getannot (intern annot-id))))
(with-current-buffer (pdf-annot-edit-contents-noselect annot)
(insert note)
(pdf-annot-edit-contents-finalize t)))
(save-buffer))))))
(defun org-noter-pdftools-embed-all-org-note-to-pdf ()
(interactive)
(org-noter--with-valid-session
(with-selected-window (org-noter--get-notes-window)
(save-excursion
(org-map-entries #'org-noter-pdftools-embed-org-note-to-pdf "ID={annot-}")))))
(defun org-noter-pdftools-embed-org-buffer-to-pdf ()
"Embed the whole org-noter doc buffer to a PDF annotation."
(interactive)
(org-noter--with-valid-session
(let* ((note (with-selected-window (org-noter--get-notes-window)
(save-excursion
(buffer-substring-no-properties
(point-min) (point-max)))))
annot-id)
(with-selected-window
(org-noter--get-doc-window)
(save-excursion
(pdf-view-goto-page 1)
(setq annot-id
(pdf-annot-get-id
(let ((annot (ignore-errors (pdf-annot-at-position '(0 . 0)))))
(if annot
annot
(funcall-interactively
#'pdf-annot-add-text-annotation
'(0 . 0)
org-pdftools-free-pointer-icon
`((color . ,org-pdftools-free-pointer-color)
(opacity . ,org-pdftools-free-pointer-opacity))))))))
(with-selected-window
(org-noter--get-doc-window)
(let ((annot (pdf-annot-getannot annot-id)))
(with-current-buffer (pdf-annot-edit-contents-noselect annot)
(insert note)
(pdf-annot-edit-contents-finalize t)))
(save-buffer))))))
(provide 'org-noter-pdftools)
;;; org-noter-pdftools.el ends here

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,446 @@
;;; org-pdftools.el --- Support for links to documents in pdfview mode -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Alexander Fu Xi
;; Author: Alexander Fu Xi <fuxialexander@gmail.com>
;; Maintainer: Alexander Fu Xi <fuxialexnader@gmail.com>
;; Homepage: https://github.com/fuxialexander/org-pdftools
;; Version: 1.0 (MV)
;; Keywords: convenience
;; Package-Requires: ((emacs "26.1") (org "9.3.6") (pdf-tools "0.8") (org-noter "1.4.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Add support for org links from pdftools buffers with more precise location control.
;;
;; https://github.com/fuxialexander/org-pdftools/
;;; Code:
(require 'subr-x)
(require 'cl-lib)
(require 'org)
(require 'org-refile nil t)
(require 'org-noter)
(require 'pdf-tools)
(require 'pdf-view)
(require 'pdf-annot)
(require 'pdf-occur)
(defgroup org-pdftools nil
"Tools for adding pdftools link support in Org mode."
:group 'tools)
(defcustom org-pdftools-get-desc-function #'org-pdftools-get-desc-default
"A function that takes 3 arguments and output a link description.
- `file': basename of the PDF file
- `page': current page number converted to string
- `text' (should have optional tag): additional text infomation like highlighted text or isearch string.
See `org-pdftools-get-desc-default' as an example."
:group 'org-pdftools
:type 'function)
(defcustom org-pdftools-path-generator #'abbreviate-file-name
"Translate your PDF file path the way you like. Take buffer-file-name as the argument."
:group 'org-pdftools
:type 'function)
(defcustom org-pdftools-path-resolver #'expand-file-name
"Resolve your translated PDF file path back to an absolute path."
:group 'org-pdftools
:type 'function)
(defcustom org-pdftools-open-custom-open nil
"Custom function to open linked pdf files."
:group 'org-pdftools
:type '(choice function nil))
(defcustom org-pdftools-use-freepointer-annot nil
"Whether prompt to use freepointer annotation or not. "
:group 'org-pdftools
:type 'boolean)
(defcustom org-pdftools-use-isearch-link nil
"Whether prompt to use isearch link or not. "
:group 'org-pdftools
:type 'boolean)
(defcustom org-pdftools-export-style 'pdftools
"Export style of org-pdftools links.
- pdftools :: export the link as is
- protocol :: export the link as a org-protocal link such that it could open pdf-tools when clicked
"
:group 'org-pdftools
:type 'symbol)
(defcustom org-pdftools-markup-pointer-function 'pdf-annot-add-underline-markup-annotation
"Color for markup pointer annotations.
Can be one of highlight/underline/strikeout/squiggly."
:group 'org-pdftools
:type 'function)
(defcustom org-pdftools-markup-pointer-color "#A9A9A9"
"Color for markup pointer annotations."
:group 'org-pdftools
:type 'string)
(defcustom org-pdftools-markup-pointer-opacity 1.0
"Opacity for markup pointer annotations."
:group 'org-pdftools
:type 'float)
(defcustom org-pdftools-free-pointer-icon "Circle"
"Color for free pointer annotations. Refer to `pdf-annot-standard-text-icons`."
:group 'org-pdftools
:type 'string)
(defcustom org-pdftools-link-prefix "pdf"
"Prefix for org-pdftools link"
:group 'org-pdftools
:type 'string)
(defcustom org-pdftools-search-string-separator "??"
"Separator of search-string."
:group 'org-pdftools
:type 'string)
(defcustom org-pdftools-free-pointer-color "#FFFFFF"
"Color for free pointer annotations."
:group 'org-pdftools
:type 'string)
(defcustom org-pdftools-free-pointer-opacity 1.0
"Opacity for free pointer annotations."
:group 'org-pdftools
:type 'float)
;; pdf://path::page++height_percent;;edges(separated by :)??isearch_string or @@occur_search_string
(defun org-pdftools-open-pdftools (link)
"Internal function to open org-pdftools LINK."
(let ((link-regexp
(concat "\\(.*\\)::\\([0-9]*\\)\\(\\+\\+\\)?\\([[0-9]\\.*[0-9]*\\)?\\(;;\\|"
(regexp-quote org-pdftools-search-string-separator)
"\\)?\\(.*\\)")))
(cond ((string-match link-regexp link)
(let ((path (match-string 1 link))
(page (match-string 2 link))
(height (match-string 4 link))
edges
search-string)
(cond ((string-equal
(match-string 5 link)
";;")
(setq edges
(match-string 6 link)))
((string-equal
(match-string 5 link)
org-pdftools-search-string-separator)
(setq search-string
(replace-regexp-in-string
"%20"
" "
(match-string 6 link)))))
(when (and path
(not (string-empty-p path)))
(if (bound-and-true-p org-noter--session)
(org-noter--with-valid-session
(let ((doc (with-selected-window
(org-noter--get-doc-window)
buffer-file-name))
(fullpath (funcall org-pdftools-path-resolver path)))
(if (string-equal doc fullpath)
(select-window
(org-noter--get-doc-window))
(let ((org-link-frame-setup
(cl-acons 'file 'find-file-other-frame org-link-frame-setup)))
(org-open-file fullpath 1)))))
(org-open-file (funcall org-pdftools-path-resolver path) 1)))
(if (and page
(not (string-empty-p page)))
(progn
(setq page (string-to-number page))
(if (bound-and-true-p org-noter--session)
(org-noter--with-valid-session
(with-selected-window
(org-noter--get-doc-window)
(pdf-view-goto-page page)))
(pdf-view-goto-page page)))
(setq page nil))
(when (and height
(not (string-empty-p height)))
(if (bound-and-true-p org-noter--session)
(org-noter--with-valid-session
(with-selected-window
(org-noter--get-doc-window)
(image-set-window-vscroll
(round
(/
(*
(string-to-number height)
(cdr (pdf-view-image-size)))
(frame-char-height))))))
(image-set-window-vscroll
(round
(/
(*
(string-to-number height)
(cdr (pdf-view-image-size)))
(frame-char-height))))))
(when (and edges
(not (string-empty-p edges)))
(if (bound-and-true-p org-noter--session)
(org-noter--with-valid-session
(with-selected-window (org-noter--get-doc-window)
(pdf-annot-show-annotation
(car (seq-filter (lambda (a)
(equal (alist-get 'edges a)
(mapcar
#'string-to-number
(split-string edges ":"))))
(pdf-info-getannots page)))
t)))
(pdf-annot-show-annotation
(car (seq-filter (lambda (a)
(equal (alist-get 'edges a)
(mapcar
#'string-to-number
(split-string edges ":"))))
(pdf-info-getannots)))
t)))
(when (and search-string
(not (string-empty-p search-string)))
(if (bound-and-true-p org-noter--session)
(org-noter--with-valid-session
(with-selected-window
(org-noter--get-doc-window)
(isearch-mode t)
(let (pdf-isearch-narrow-to-page t)
(isearch-yank-string search-string))
))
(isearch-mode t)
(let (pdf-isearch-narrow-to-page t)
(isearch-yank-string search-string))))))
((string-match
"\\(.*\\)@@\\(.*\\)"
link)
(let* ((paths (match-string 1 link))
(occur-search-string (match-string 2 link))
(pathlist (split-string paths "%&%")))
(pdf-occur-search
pathlist
occur-search-string)))
((org-open-file link 1)))))
(defun org-pdftools-get-link ()
"Get link from the active pdf buffer."
(let* ((path
(with-current-buffer (current-buffer)
(funcall org-pdftools-path-generator (buffer-file-name))))
(page (pdf-view-current-page))
(edges (if (pdf-view-active-region-p)
(pdf-annot-get-id
(funcall
org-pdftools-markup-pointer-function
(pdf-view-active-region)
org-pdftools-markup-pointer-color
`((opacity . ,org-pdftools-markup-pointer-opacity))))
(if (and (not (bound-and-true-p org-noter--session))
(pdf-annot-getannots page))
(condition-case nil
(pdf-annot-get-id
(pdf-annot-read-annotation
"Click the annotation that you want to link to."))
(error
(if org-pdftools-use-freepointer-annot
(pdf-annot-get-id
(funcall-interactively
#'pdf-annot-add-text-annotation
(pdf-util-read-image-position
"Click where a new text annotation should be added ...")
org-pdftools-free-pointer-icon
`((color . ,org-pdftools-free-pointer-color)
(opacity . ,org-pdftools-free-pointer-opacity))))
nil)))
(if org-pdftools-use-freepointer-annot
(pdf-annot-get-id
(funcall-interactively
#'pdf-annot-add-text-annotation
(pdf-util-read-image-position
"Click where a new text annotation should be added ...")
org-pdftools-free-pointer-icon
`((color . ,org-pdftools-free-pointer-color)
(opacity . ,org-pdftools-free-pointer-opacity))))
nil))))
(edges (pdf-annot-get
(pdf-info-getannot
edges
path)
'edges))
(height (cond ((bound-and-true-p edges)
(nth 1 edges))
(t
(/
(*
(or (image-mode-window-get
'vscroll)
0)
(frame-char-height))
(float
(cdr (pdf-view-image-size)))))))
;; pdf://path::page++height_percent;;edges(separated by :)\\|??search-string
(search-string (if (and (not edges)
org-pdftools-use-isearch-link)
isearch-string
""))
(link (concat
org-pdftools-link-prefix ":"
path
"::"
(number-to-string page)
"++"
(format "%.2f" height)
";;"
(mapconcat #'number-to-string edges ":")
;; (if edges
;; (concat
;; ";;"
;; (symbol-name edges))
;; (if (not (string-empty-p search-string))
;; (concat
;; org-pdftools-search-string-separator
;; (replace-regexp-in-string
;; " "
;; "%20"
;; search-string))
;; (message
;; " Reminder: You haven't performed a isearch!") ""))
)))
link))
(defun org-pdftools-get-desc-default (file page &optional text)
(concat file ".pdf: Page " page (when text (concat "; Quoting: " text))))
;;;###autoload
(defun org-pdftools-open (link)
"Function to open org-pdftools LINK."
(if (and (display-graphic-p)
(featurep 'pdf-tools))
(org-pdftools-open-pdftools
link)
(if (bound-and-true-p org-pdftools-open-custom-open)
(funcall org-pdftools-open-custom-open link)
(let* ((path (when (string-match
"\\(.+\\)::.+" link)
(match-string 1 link))))
(org-open-file path)))))
;;;###autoload
(defun org-pdftools-store-link ()
"Store a link to a pdfview/pdfoccur buffer."
(cond ((eq major-mode 'pdf-view-mode)
;; This buffer is in pdf-view-mode
(let* ((file (file-name-base (pdf-view-buffer-file-name)))
(quot (if (pdf-view-active-region-p)
(replace-regexp-in-string "\n" " "
(mapconcat 'identity (pdf-view-active-region-text) ? ))))
(page (number-to-string (pdf-view-current-page)))
(link (org-pdftools-get-link))
(isearchstr (if (string-match (concat ".*" (regexp-quote org-pdftools-search-string-separator) "\\(.*\\)") link)
(match-string 1 link)))
(desc (funcall org-pdftools-get-desc-function file page (or quot isearchstr))))
(org-link-store-props
:type org-pdftools-link-prefix
:link link
:description desc)))
((eq major-mode 'pdf-occur-buffer-mode)
(let* ((paths (mapconcat #'identity (mapcar #'car
pdf-occur-search-documents) "%&%"))
(occur-search-string pdf-occur-search-string)
(link (concat org-pdftools-link-prefix ":"
paths "@@" occur-search-string)))
(org-link-store-props
:type org-pdftools-link-prefix
:link link
:description (concat "Search: " occur-search-string))))))
;;;###autoload
(defun org-pdftools-export (link description format)
"Export the pdfview LINK with DESCRIPTION for FORMAT from Org files."
(let* (path loc page)
(if (string-match "\\(.+\\)::\\(.*\\)" link)
(progn
(setq path (match-string 1 link))
(setq loc (match-string 2 link))
(if (string-match "\\([0-9]+\\)++\\(.*\\)" loc)
(setq page (match-string 1 loc))
(setq page loc)))
(setq path link))
;; `org-export-file-uri` expands the filename correctly
(setq path (org-export-file-uri (org-link-escape path)))
(cond ((eq format 'html)
(format
"<a href=\"%s#page=%s\">%s</a>"
path
page
description))
((eq format 'latex)
(format
"\\href{%s}{%s}"
path
description))
((eq format 'ascii)
(format "%s (%s)" description path))
(t path))))
;;;###autoload
(defun org-pdftools-setup-link (&optional prefix)
"Set up pdf: links in org-mode."
(setq org-pdftools-prefix (or prefix org-pdftools-link-prefix))
(org-link-set-parameters org-pdftools-prefix
:follow #'org-pdftools-open
:complete #'org-pdftools-complete-link
:store #'org-pdftools-store-link
:export #'org-pdftools-export))
;;;###autoload
(defun org-pdftools-complete-link (&optional arg)
"Use the existing file name completion for file.
Links to get the file name, then ask the user for the page number
and append it. ARG is passed to `org-link-complete-file'."
(let* ((pdf-or-dir-p '(lambda (file-name)
(string-match "/$\\|.pdf$" file-name)))
;; pdf-or-dir-p, a predicate returns t when file's path
;; is a directory or ends with .pdf.
(current-read-file-name-function read-file-name-function)
;; Replace the `read-file-name-function' temporarily,
;; See its docstring for more.
(read-file-name-function
;; This is the replacement, it's just a wrapper, it passes
;; the same argument to the old read file name function, one
;; difference is the PREDICATE arguement being our defined
;; pdf-or-dir-p.
;; Why?: So that `org-link-complete-file' only "show" pdf file
;; or directory.
(lambda
(prompt &optional dir default-filename mustmatch initial
predicate)
(funcall current-read-file-name-function
prompt dir default-filename mustmatch initial
pdf-or-dir-p))))
(concat
(replace-regexp-in-string
"^file:"
(concat org-pdftools-link-prefix ":")
(org-link-complete-file arg))
"::"
(read-from-minibuffer
"Page:"
"1"))))
(provide 'org-pdftools)
;;; org-pdftools.el ends here

View file

@ -0,0 +1,3 @@
\begin{itemize}
\item
\end{itemize}

View file

@ -0,0 +1,7 @@
\begin{itemize}
\color{blue}
\item Marking notes
\begin{itemize}
\item
\end{itemize}
\end{itemize}

View file

@ -0,0 +1,4 @@
\item Extra:
\begin{itemize}
\item
\end{itemize}

View file

@ -0,0 +1,11 @@
\begin{minipage}{0.95\textwidth}
\question[4]
\vspace{0.2cm}
\begin{choices}
\choice
\choice
\choice
\choice
\end{choices}
\vspace{0.2cm}
\end{minipage}\vspace{0.1cm}

View file

@ -0,0 +1 @@
\mynewpage

View file

@ -0,0 +1,3 @@
\begin{parts}
\part
\end{parts}

View file

@ -0,0 +1,2 @@
\begin{solution}[5cm]
\end{solution}

View file

@ -0,0 +1 @@
./org-mode/

View file

@ -0,0 +1,7 @@
#+REVEAL_HTML: <div style="font-size: 20px; display: flex; justify-content: center; align-items: center;">
#+html: <div class="block yellow1">
#+html: <div>
-
#+html: </div>
#+html: </div>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,17 @@
#+REVEAL_HTML: <div style="font-size: 20px; display: flex; justify-content: center; align-items: center;">
#+html: <div class="block red">
#+html: <div>
Point 1
Point 2
#+html: </div>
#+html: </div>
#+html: <div class="block green">
#+html: <div>
Point 1
Point 2
#+html: </div>
#+html: </div>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,29 @@
#+REVEAL_HTML: <div style="font-size: 20px; display: flex; justify-content: center; align-items: center;">
#+html: <div style="display: flex; flex-wrap: wrap; justify-content: center;">
#+html: <div class="block4 red">
#+REVEAL_HTML:<h3> Text </h3>
#+html: </div>
#+html: <div class="block4 red">
#+REVEAL_HTML:<h3> Text </h3>
#+html: </div>
#+html: <div class="block2 yellow">
#+REVEAL_HTML:<br><br><h3>Title</h3>
Text
#+html: </div>
#+html: <div class="block2 yellow">
#+REVEAL_HTML:<br><br><h3>Title</h3>
Text
#+html: </div>
#+html: </div>

View file

@ -0,0 +1,26 @@
#+REVEAL_HTML: <div style="font-size: 20px; display: flex; justify-content: center; align-items: center;">
#+html: <div class="block red">
#+html: <div>
Point 1
Point 2
#+html: </div>
#+html: </div>
#+html: <div class="block green">
#+html: <div>
Point 1
Point 2
#+html: </div>
#+html: </div>
#+html: <div class="block yellow">
#+html: <div>
Point 1
Point 2
#+html: </div>
#+html: </div>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,53 @@
#+REVEAL_HTML: <div class="column" style="float:left; width:33.33%";>
#+html: <div class="block4a red" style="font-size:30px">
#+REVEAL_HTML:<h3>title 1</h3>
#+html: </div>
#+html: <div class="block2a yellow" style="font-size:20px">
text1
#+html: </div>
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div class="column" style="float:left; width:33.33%";>
#+html: <div class="block4a red" style="font-size:30px">
#+REVEAL_HTML:<h3>title 2 </h3>
#+html: </div>
#+html: <div class="block2a yellow" style="font-size:20px">
text 2
#+html: </div>
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div class="column" style="float:left; width:33.33%";>
#+html: <div class="block4a red" style="font-size:30px">
#+REVEAL_HTML:<h3>title 3 </h3>
#+html: </div>
#+html: <div class="block2a yellow" style="font-size:20px">
text3
#+html: </div>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,31 @@
#+REVEAL_HTML: <div style="font-size: 20px; display: flex; justify-content: center; align-items: center;">
#+html: <div style="display: flex; flex-wrap: wrap; justify-content: center;">
#+html: <div class="block2 red">
#+REVEAL_HTML:<br><br><h3>Title</h3>
Text
#+html: </div>
#+html: <div class="block2 green">
#+REVEAL_HTML:<br><br><h3>Title</h3>
Text
#+html: </div>
#+html: <div class="block2 yellow">
#+REVEAL_HTML:<br><br><h3>Title</h3>
Text
#+html: </div>
#+html: <div class="block2 blue">
#+REVEAL_HTML:<br><br><h3>Title</h3>
Text
#+html: </div>
#+html: </div>

View file

@ -0,0 +1,3 @@
#+begin_ai
#+end_ai

View file

@ -0,0 +1,18 @@
#+REVEAL_HTML: <div style="display: flex; justify-content: space-between; align-items: center;">
#+REVEAL_HTML: <div class="column" style="width:50%; padding: 1em;">
#+html: <div class="block yellow1" style="height: 350px;">
#+REVEAL_HTML: <div style="font-size: 30px";>
text 1
text 2
#+REVEAL_HTML: </div>
#+html: </div>
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div class="column" style="width:50%; padding: 1em;">
#+ATTR_HTML: :height 400
[[./images/plaatje.png]]
#+REVEAL_HTML: </div>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,36 @@
*
:PROPERTIES:
:CUSTOM_ID: 7
:END:
#+REVEAL_HTML:<h1>my (none of your)<br>Business card</h1>
#+BEGIN_NOTES
#+REVEAL_HTML:<h3>Personal projects</h3>
[[https://opentech-auc.org/posts/2024-05-19-introducing-mastodon/][Mastodon]] account: [[https://social.edu.nl/deck/@MishaVelthuis]]
Blog: https://mishathings.org/
Music: https://mishathings.org/music_things/
Reading: https://bookrastinating.com/user/misha/books/read
#+REVEAL_HTML:<h3>OpenTech(AUC)</h3>
We are a group of students and staff members at Amsterdam University College. We care about Open Standards, Free Software, and Open Data.
We believe that people need to take back control over their digital lives, and we believe that we, at the university, have a big responsibility to help each other do so.
https://opentech-auc.org/
See for example: [[https://www.youtube.com/watch?v=fuFlMtZmvY0][the internet is broken]] and [[https://www.youtube.com/watch?v=fuFlMtZmvY0][this]] is what we can do about it.
#+REVEAL_HTML:<h3>Staff Students Platform</h3>
Staff Students Platform (SSP) is a bottom-up, grassroots collective of students and staff who are determined to work together to organize and facilitate the kind of events that we feel are necessary to (re)build understanding at AUC, in the face of the ongoing violence in Palestine and the protests addressing it.
https://staffstudentsplatform-auc.org/
#+END_NOTES

View file

@ -0,0 +1,14 @@
| Criterion | Weight | Grade |
|-------------------------------------------------+--------+-------|
| Quality of the research question and/or thesis | 1/7 | |
| Review/synthesis of literature/research context | 1/7 | |
| Methodology | 1/7 | |
| Analysis and Argument | 1/7 | |
| Discussion and implications | 1/7 | |
| Organization and structure | 1/7 | |
| Effective communication | 1/7 | |
|-------------------------------------------------+--------+-------|
| Overall | | |
#+TBLFM: @9\$3=vsum(@2\$2..@8\$2*@2\$3..@8\$3);%.2f

View file

@ -0,0 +1,19 @@
#+begin_src python
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(0,50,50)
y=x
plt.plot(x,y)
plt.xlabel('t')
plt.ylabel('y')
plt.grid(True)
plt.savefig('/tmp/output-fig.png')
#+end_src
#+RESULTS:
: None
#+ATTR_HTML: :width 350
[[/tmp/output-fig.png]]

View file

@ -0,0 +1,24 @@
#+begin_src python
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(0,100,100)
I=20 # inflow
R=0.5 # resistance
A=25 # surface area of reservoir
rC=1/(R*A) # rate constant
C= I*A*R # starting postion. At I*A*R (equilibrium stock size) graph starts at (0,0)
y=(I/rC)-C*np.exp(-rC*x)
plt.plot(x,y)
plt.xlabel('x')
plt.ylabel('y')
plt.grid(True)
plt.savefig('/tmp/output-fig2.png')
#+end_src
#+RESULTS:
: None
#+ATTR_HTML: :width 350
[[/tmp/output-fig2.png]]

View file

@ -0,0 +1,28 @@
#+begin_src python
import matplotlib.pyplot as plt
import numpy as np
Y_cont=[]
Y=0 #start of Y
inflow=20
dt=1
T_end=100
T_cont=np.linspace(0,T_end,int(T_end/dt))
A=25 # surface
R=0.5 # resistance
rC=1/(R*A) # rate constant
for t in T_cont:
dY=(inflow-rC*Y)*dt
Y=Y+dY
Y_cont.append(Y)
plt.plot(T_cont,Y_cont)
plt.xlabel('t')
plt.ylabel('y')
plt.grid(True)
plt.savefig('/tmp/output-fig.png')
#+end_src
#+RESULTS:
#+ATTR_HTML: :width 350
[[/tmp/output-fig.png]]

View file

@ -0,0 +1,3 @@
#+begin_src emacs-lisp
#+end_src

View file

@ -0,0 +1 @@
#+HTML: <iframe src="url" allowfullscreen="" width="400" height="315" frameborder="0"></iframe>

View file

@ -0,0 +1,3 @@
#+begin_src python :results output
#+end_src

View file

@ -0,0 +1,6 @@
#+begin_src racket :results output
(require test-engine/racket-tests)
(test)
#+end_src

View file

@ -0,0 +1,5 @@
#+REVEAL_HTML: <div class='multiCol'> <div class='col'>
#+REVEAL_HTML: </div> <div class='col'>
#+REVEAL_HTML: </div> </div>

View file

@ -0,0 +1,12 @@
#+TITLE: Main title
#+SUBTITLE: Subtitle
#+EMAIL:m.velthuis@uva.nl
#+CREATED: [2023-09-12 di 09:13]
#+LAST_MODIFIED: [2024-09-26 Thu 12:59]
#+REVEAL_THEME: solarized
#+OPTIONS: reveal_title_slide:"<h3>%t</h3><h4>%s</h4><h5>Misha Velthuis</h5><h6>%e</h6><h6>Specify date</h6>"
#+REVEAL_ROOT: https://cdn.jsdelivr.net/npm/reveal.js
#+REVEAL_INIT_OPTIONS: width:1100, slideNumber:true, hash:true, showNotes:'separate-page'
#+REVEAL_TITLE_SLIDE_BACKGROUND: ./../../../images/ISS_earth.en.jpg
#+REVEAL_TITLE_SLIDE_BACKGROUND_OPACITY: 0.25
#+REVEAL_EXTRA_CSS: https://mishathings.org/static/reveal-extra.css

View file

@ -0,0 +1 @@
#+REVEAL_HTML:

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: reveal-notes
# key: reveal-notes
# --
#+BEGIN_NOTES
#+END_NOTES

View file

@ -0,0 +1,3 @@
#+REVEAL_HTML: <div style="font-size: 10px";>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,7 @@
#+REVEAL_HTML: <div class="column" style="float:left; width:50%";>
-
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div class="column" style="float:right; width:50%";>
-
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,11 @@
#+REVEAL_HTML: <div class="column" style="float:left; width:33.33%";>
-
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div class="column" style="float:left; width:33.33%";>
-
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div class="column" style="float:left; width:33.33%";>
-
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,24 @@
#+REVEAL_HTML: <div style="width:50%; float:left;">
#+REVEAL_HTML: <div style="width:100%; height:50%;">
<-- Content Q1 -->
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div style="width:100%; height:50%;">
<!-- Content Q3 -->
#+REVEAL_HTML: </div>
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div style="width:50%; float:right;">
#+REVEAL_HTML: <div style="width:100%; height:50%;">
<!-- Content Q2 -->
#+REVEAL_HTML: </div>
#+REVEAL_HTML: <div style="width:100%; height:50%;">
<!-- Content Q4 -->
#+REVEAL_HTML: </div>
#+REVEAL_HTML: </div>

View file

@ -0,0 +1,2 @@
#+end_src
#+begin_src emacs-lisp

View file

@ -0,0 +1,26 @@
import sys
import datetime
import pytz
time=sys.argv[1]
tz1=sys.argv[2]
tz2=sys.argv[3]
# if a day is given use that day
# if not use today
if len(sys.argv) < 5:
today = datetime.date.today().strftime("%Y-%m-%d")
dt = "%s %s" % (today,time)
else:
dt = "%s %s" % (sys.argv[4],time)
tz1 = pytz.timezone(tz1)
tz2 = pytz.timezone(tz2)
dt = datetime.datetime.strptime(dt,"%Y-%m-%d %H:%M")
dt = tz1.localize(dt)
dt = dt.astimezone(tz2)
dt = dt.strftime("%Y-%m-%d %A %H:%Mh")
print(dt,end="")
# <2025-03-26 05:00-08:30>

View file

@ -0,0 +1,558 @@
(defun timezone-convert ()
(interactive)
(let* ((timezones
`(("Africa/Accra" . "Accra")
("Africa/Addis_Ababa" . "Addis_Ababa")
("Africa/Algiers" . "Algiers")
("Africa/Asmara" . "Asmara")
("Africa/Asmera" . "Asmera")
("Africa/Bamako" . "Bamako")
("Africa/Bangui" . "Bangui")
("Africa/Banjul" . "Banjul")
("Africa/Bissau" . "Bissau")
("Africa/Blantyre" . "Blantyre")
("Africa/Brazzaville" . "Brazzaville")
("Africa/Bujumbura" . "Bujumbura")
("Africa/Cairo" . "Cairo")
("Africa/Casablanca" . "Casablanca")
("Africa/Ceuta" . "Ceuta")
("Africa/Conakry" . "Conakry")
("Africa/Dakar" . "Dakar")
("Africa/Dar_es_Salaam" . "Dar_es_Salaam")
("Africa/Djibouti" . "Djibouti")
("Africa/Douala" . "Douala")
("Africa/El_Aaiun" . "El_Aaiun")
("Africa/Freetown" . "Freetown")
("Africa/Gaborone" . "Gaborone")
("Africa/Harare" . "Harare")
("Africa/Johannesburg" . "Johannesburg")
("Africa/Juba" . "Juba")
("Africa/Kampala" . "Kampala")
("Africa/Khartoum" . "Khartoum")
("Africa/Kigali" . "Kigali")
("Africa/Kinshasa" . "Kinshasa")
("Africa/Lagos" . "Lagos")
("Africa/Libreville" . "Libreville")
("Africa/Lome" . "Lome")
("Africa/Luanda" . "Luanda")
("Africa/Lubumbashi" . "Lubumbashi")
("Africa/Lusaka" . "Lusaka")
("Africa/Malabo" . "Malabo")
("Africa/Maputo" . "Maputo")
("Africa/Maseru" . "Maseru")
("Africa/Mbabane" . "Mbabane")
("Africa/Mogadishu" . "Mogadishu")
("Africa/Monrovia" . "Monrovia")
("Africa/Nairobi" . "Nairobi")
("Africa/Ndjamena" . "Ndjamena")
("Africa/Niamey" . "Niamey")
("Africa/Nouakchott" . "Nouakchott")
("Africa/Ouagadougou" . "Ouagadougou")
("Africa/Porto-Novo" . "Porto-Novo")
("Africa/Sao_Tome" . "Sao_Tome")
("Africa/Timbuktu" . "Timbuktu")
("Africa/Tripoli" . "Tripoli")
("Africa/Tunis" . "Tunis")
("Africa/Windhoek" . "Windhoek")
("America/Adak" . "Adak")
("America/Anchorage" . "Anchorage")
("America/Anguilla" . "Anguilla")
("America/Antigua" . "Antigua")
("America/Araguaina" . "Araguaina")
("America/Argentina/Buenos_Aires" . "Argentin")
("America/Argentina/Catamarca" . "Argentin")
("America/Argentina/ComodRivadavia" . "Argentin")
("America/Argentina/Cordoba" . "Argentin")
("America/Argentina/Jujuy" . "Argentin")
("America/Argentina/La_Rioja" . "Argentin")
("America/Argentina/Mendoza" . "Argentin")
("America/Argentina/Rio_Gallegos" . "Argentin")
("America/Argentina/Salta" . "Argentin")
("America/Argentina/San_Juan" . "Argentin")
("America/Argentina/San_Luis" . "Argentin")
("America/Argentina/Tucuman" . "Argentin")
("America/Argentina/Ushuaia" . "Argentin")
("America/Aruba" . "Aruba")
("America/Asuncion" . "Asuncion")
("America/Atikokan" . "Atikokan")
("America/Atka" . "Atka")
("America/Bahia" . "Bahia")
("America/Bahia_Banderas" . "Bahia_Banderas")
("America/Barbados" . "Barbados")
("America/Belem" . "Belem")
("America/Belize" . "Belize")
("America/Blanc-Sablon" . "Blanc-Sablon")
("America/Boa_Vista" . "Boa_Vista")
("America/Bogota" . "Bogota")
("America/Boise" . "Boise")
("America/Buenos_Aires" . "Buenos_Aires")
("America/Cambridge_Bay" . "Cambridge_Bay")
("America/Campo_Grande" . "Campo_Grande")
("America/Cancun" . "Cancun")
("America/Caracas" . "Caracas")
("America/Catamarca" . "Catamarca")
("America/Cayenne" . "Cayenne")
("America/Cayman" . "Cayman")
("America/Chicago" . "Chicago")
("America/Chihuahua" . "Chihuahua")
("America/Ciudad_Juarez" . "Ciudad_Juarez")
("America/Coral_Harbour" . "Coral_Harbour")
("America/Cordoba" . "Cordoba")
("America/Costa_Rica" . "Costa_Rica")
("America/Creston" . "Creston")
("America/Cuiaba" . "Cuiaba")
("America/Curacao" . "Curacao")
("America/Danmarkshavn" . "Danmarkshavn")
("America/Dawson" . "Dawson")
("America/Dawson_Creek" . "Dawson_Creek")
("America/Denver" . "Denver")
("America/Detroit" . "Detroit")
("America/Dominica" . "Dominica")
("America/Edmonton" . "Edmonton")
("America/Eirunepe" . "Eirunepe")
("America/El_Salvador" . "El_Salvador")
("America/Ensenada" . "Ensenada")
("America/Fort_Nelson" . "Fort_Nelson")
("America/Fort_Wayne" . "Fort_Wayne")
("America/Fortaleza" . "Fortaleza")
("America/Glace_Bay" . "Glace_Bay")
("America/Godthab" . "Godthab")
("America/Goose_Bay" . "Goose_Bay")
("America/Grand_Turk" . "Grand_Turk")
("America/Grenada" . "Grenada")
("America/Guadeloupe" . "Guadeloupe")
("America/Guatemala" . "Guatemala")
("America/Guayaquil" . "Guayaquil")
("America/Guyana" . "Guyana")
("America/Halifax" . "Halifax")
("America/Havana" . "Havana")
("America/Hermosillo" . "Hermosillo")
("America/Indiana/Indianapolis" . "Indian")
("America/Indiana/Knox" . "Indian")
("America/Indiana/Marengo" . "Indian")
("America/Indiana/Petersburg" . "Indian")
("America/Indiana/Tell_City" . "Indian")
("America/Indiana/Vevay" . "Indian")
("America/Indiana/Vincennes" . "Indian")
("America/Indiana/Winamac" . "Indian")
("America/Indianapolis" . "Indianapolis")
("America/Inuvik" . "Inuvik")
("America/Iqaluit" . "Iqaluit")
("America/Jamaica" . "Jamaica")
("America/Jujuy" . "Jujuy")
("America/Juneau" . "Juneau")
("America/Kentucky/Louisville" . "Kentuck")
("America/Kentucky/Monticello" . "Kentuck")
("America/Knox_IN" . "Knox_IN")
("America/Kralendijk" . "Kralendijk")
("America/La_Paz" . "La_Paz")
("America/Lima" . "Lima")
("America/Los_Angeles" . "Los_Angeles")
("America/Louisville" . "Louisville")
("America/Lower_Princes" . "Lower_Princes")
("America/Maceio" . "Maceio")
("America/Managua" . "Managua")
("America/Manaus" . "Manaus")
("America/Marigot" . "Marigot")
("America/Martinique" . "Martinique")
("America/Matamoros" . "Matamoros")
("America/Mazatlan" . "Mazatlan")
("America/Mendoza" . "Mendoza")
("America/Menominee" . "Menominee")
("America/Merida" . "Merida")
("America/Metlakatla" . "Metlakatla")
("America/Mexico_City" . "Mexico_City")
("America/Miquelon" . "Miquelon")
("America/Moncton" . "Moncton")
("America/Monterrey" . "Monterrey")
("America/Montevideo" . "Montevideo")
("America/Montreal" . "Montreal")
("America/Montserrat" . "Montserrat")
("America/Nassau" . "Nassau")
("America/New_York" . "New_York")
("America/Nipigon" . "Nipigon")
("America/Nome" . "Nome")
("America/Noronha" . "Noronha")
("America/North_Dakota/Beulah" . "North_Dakot")
("America/North_Dakota/Center" . "North_Dakot")
("America/North_Dakota/New_Salem" . "North_Dakot")
("America/Nuuk" . "Nuuk")
("America/Ojinaga" . "Ojinaga")
("America/Panama" . "Panama")
("America/Pangnirtung" . "Pangnirtung")
("America/Paramaribo" . "Paramaribo")
("America/Phoenix" . "Phoenix")
("America/Port-au-Prince" . "Port-au-Prince")
("America/Port_of_Spain" . "Port_of_Spain")
("America/Porto_Acre" . "Porto_Acre")
("America/Porto_Velho" . "Porto_Velho")
("America/Puerto_Rico" . "Puerto_Rico")
("America/Punta_Arenas" . "Punta_Arenas")
("America/Rainy_River" . "Rainy_River")
("America/Rankin_Inlet" . "Rankin_Inlet")
("America/Recife" . "Recife")
("America/Regina" . "Regina")
("America/Resolute" . "Resolute")
("America/Rio_Branco" . "Rio_Branco")
("America/Rosario" . "Rosario")
("America/Santa_Isabel" . "Santa_Isabel")
("America/Santarem" . "Santarem")
("America/Santiago" . "Santiago")
("America/Santo_Domingo" . "Santo_Domingo")
("America/Sao_Paulo" . "Sao_Paulo")
("America/Scoresbysund" . "Scoresbysund")
("America/Shiprock" . "Shiprock")
("America/Sitka" . "Sitka")
("America/St_Barthelemy" . "St_Barthelemy")
("America/St_Johns" . "St_Johns")
("America/St_Kitts" . "St_Kitts")
("America/St_Lucia" . "St_Lucia")
("America/St_Thomas" . "St_Thomas")
("America/St_Vincent" . "St_Vincent")
("America/Swift_Current" . "Swift_Current")
("America/Tegucigalpa" . "Tegucigalpa")
("America/Thule" . "Thule")
("America/Thunder_Bay" . "Thunder_Bay")
("America/Tijuana" . "Tijuana")
("America/Toronto" . "Toronto")
("America/Tortola" . "Tortola")
("America/Vancouver" . "Vancouver")
("America/Virgin" . "Virgin")
("America/Whitehorse" . "Whitehorse")
("America/Winnipeg" . "Winnipeg")
("America/Yakutat" . "Yakutat")
("America/Yellowknife" . "Yellowknife")
("Antarctica/Casey" . "Casey")
("Antarctica/Davis" . "Davis")
("Antarctica/DumontDUrville" . "DumontDUrville")
("Antarctica/Macquarie" . "Macquarie")
("Antarctica/Mawson" . "Mawson")
("Antarctica/McMurdo" . "McMurdo")
("Antarctica/Palmer" . "Palmer")
("Antarctica/Rothera" . "Rothera")
("Antarctica/South_Pole" . "South_Pole")
("Antarctica/Syowa" . "Syowa")
("Antarctica/Troll" . "Troll")
("Antarctica/Vostok" . "Vostok")
("Arctic/Longyearbyen" . "Longyearbyen")
("Asia/Aden" . "Aden")
("Asia/Almaty" . "Almaty")
("Asia/Amman" . "Amman")
("Asia/Anadyr" . "Anadyr")
("Asia/Aqtau" . "Aqtau")
("Asia/Aqtobe" . "Aqtobe")
("Asia/Ashgabat" . "Ashgabat")
("Asia/Ashkhabad" . "Ashkhabad")
("Asia/Atyrau" . "Atyrau")
("Asia/Baghdad" . "Baghdad")
("Asia/Bahrain" . "Bahrain")
("Asia/Baku" . "Baku")
("Asia/Bangkok" . "Bangkok")
("Asia/Barnaul" . "Barnaul")
("Asia/Beirut" . "Beirut")
("Asia/Bishkek" . "Bishkek")
("Asia/Brunei" . "Brunei")
("Asia/Calcutta" . "Calcutta")
("Asia/Chita" . "Chita")
("Asia/Choibalsan" . "Choibalsan")
("Asia/Chongqing" . "Chongqing")
("Asia/Chungking" . "Chungking")
("Asia/Colombo" . "Colombo")
("Asia/Dacca" . "Dacca")
("Asia/Damascus" . "Damascus")
("Asia/Dhaka" . "Dhaka")
("Asia/Dili" . "Dili")
("Asia/Dubai" . "Dubai")
("Asia/Dushanbe" . "Dushanbe")
("Asia/Famagusta" . "Famagusta")
("Asia/Gaza" . "Gaza")
("Asia/Harbin" . "Harbin")
("Asia/Hebron" . "Hebron")
("Asia/Ho_Chi_Minh" . "Ho_Chi_Minh")
("Asia/Hong_Kong" . "Hong_Kong")
("Asia/Hovd" . "Hovd")
("Asia/Irkutsk" . "Irkutsk")
("Asia/Istanbul" . "Istanbul")
("Asia/Jakarta" . "Jakarta")
("Asia/Jayapura" . "Jayapura")
("Asia/Jerusalem" . "Jerusalem")
("Asia/Kabul" . "Kabul")
("Asia/Kamchatka" . "Kamchatka")
("Asia/Karachi" . "Karachi")
("Asia/Kashgar" . "Kashgar")
("Asia/Kathmandu" . "Kathmandu")
("Asia/Katmandu" . "Katmandu")
("Asia/Khandyga" . "Khandyga")
("Asia/Kolkata" . "Kolkata")
("Asia/Krasnoyarsk" . "Krasnoyarsk")
("Asia/Kuala_Lumpur" . "Kuala_Lumpur")
("Asia/Kuching" . "Kuching")
("Asia/Kuwait" . "Kuwait")
("Asia/Macao" . "Macao")
("Asia/Macau" . "Macau")
("Asia/Magadan" . "Magadan")
("Asia/Makassar" . "Makassar")
("Asia/Manila" . "Manila")
("Asia/Muscat" . "Muscat")
("Asia/Nicosia" . "Nicosia")
("Asia/Novokuznetsk" . "Novokuznetsk")
("Asia/Novosibirsk" . "Novosibirsk")
("Asia/Omsk" . "Omsk")
("Asia/Oral" . "Oral")
("Asia/Phnom_Penh" . "Phnom_Penh")
("Asia/Pontianak" . "Pontianak")
("Asia/Pyongyang" . "Pyongyang")
("Asia/Qatar" . "Qatar")
("Asia/Qostanay" . "Qostanay")
("Asia/Qyzylorda" . "Qyzylorda")
("Asia/Rangoon" . "Rangoon")
("Asia/Riyadh" . "Riyadh")
("Asia/Saigon" . "Saigon")
("Asia/Sakhalin" . "Sakhalin")
("Asia/Samarkand" . "Samarkand")
("Asia/Seoul" . "Seoul")
("Asia/Shanghai" . "Shanghai")
("Asia/Singapore" . "Singapore")
("Asia/Srednekolymsk" . "Srednekolymsk")
("Asia/Taipei" . "Taipei")
("Asia/Tashkent" . "Tashkent")
("Asia/Tbilisi" . "Tbilisi")
("Asia/Tehran" . "Tehran")
("Asia/Tel_Aviv" . "Tel_Aviv")
("Asia/Thimbu" . "Thimbu")
("Asia/Thimphu" . "Thimphu")
("Asia/Tokyo" . "Tokyo")
("Asia/Tomsk" . "Tomsk")
("Asia/Ujung_Pandang" . "Ujung_Pandang")
("Asia/Ulaanbaatar" . "Ulaanbaatar")
("Asia/Ulan_Bator" . "Ulan_Bator")
("Asia/Urumqi" . "Urumqi")
("Asia/Ust-Nera" . "Ust-Nera")
("Asia/Vientiane" . "Vientiane")
("Asia/Vladivostok" . "Vladivostok")
("Asia/Yakutsk" . "Yakutsk")
("Asia/Yangon" . "Yangon")
("Asia/Yekaterinburg" . "Yekaterinburg")
("Asia/Yerevan" . "Yerevan")
("Atlantic/Azores" . "Azores")
("Atlantic/Bermuda" . "Bermuda")
("Atlantic/Canary" . "Canary")
("Atlantic/Cape_Verde" . "Cape_Verde")
("Atlantic/Faeroe" . "Faeroe")
("Atlantic/Faroe" . "Faroe")
("Atlantic/Jan_Mayen" . "Jan_Mayen")
("Atlantic/Madeira" . "Madeira")
("Atlantic/Reykjavik" . "Reykjavik")
("Atlantic/South_Georgia" . "South_Georgia")
("Atlantic/St_Helena" . "St_Helena")
("Atlantic/Stanley" . "Stanley")
("Australia/ACT" . "ACT")
("Australia/Adelaide" . "Adelaide")
("Australia/Brisbane" . "Brisbane")
("Australia/Broken_Hill" . "Broken_Hill")
("Australia/Canberra" . "Canberra")
("Australia/Currie" . "Currie")
("Australia/Darwin" . "Darwin")
("Australia/Eucla" . "Eucla")
("Australia/Hobart" . "Hobart")
("Australia/LHI" . "LHI")
("Australia/Lindeman" . "Lindeman")
("Australia/Lord_Howe" . "Lord_Howe")
("Australia/Melbourne" . "Melbourne")
("Australia/North" . "North")
("Australia/NSW" . "NSW")
("Australia/Perth" . "Perth")
("Australia/Queensland" . "Queensland")
("Australia/South" . "South")
("Australia/Sydney" . "Sydney")
("Australia/Tasmania" . "Tasmania")
("Australia/Victoria" . "Victoria")
("Australia/West" . "West")
("Australia/Yancowinna" . "Yancowinna")
("Brazil/Acre" . "Acre")
("Brazil/DeNoronha" . "DeNoronha")
("Brazil/East" . "East")
("Brazil/West" . "West")
("Canada/Atlantic" . "Atlantic")
("Canada/Central" . "Central")
("Canada/Eastern" . "Eastern")
("Canada/Mountain" . "Mountain")
("Canada/Newfoundland" . "Newfoundland")
("Canada/Pacific" . "Pacific")
("Canada/Saskatchewan" . "Saskatchewan")
("Canada/Yukon" . "Yukon")
("Etc/GMT" . "GMT")
("Etc/GMT+0" . "GMT+0")
("Etc/GMT+1" . "GMT+1")
("Etc/GMT+10" . "GMT+10")
("Etc/GMT+11" . "GMT+11")
("Etc/GMT+12" . "GMT+12")
("Etc/GMT+2" . "GMT+2")
("Etc/GMT+3" . "GMT+3")
("Etc/GMT+4" . "GMT+4")
("Etc/GMT+5" . "GMT+5")
("Etc/GMT+6" . "GMT+6")
("Etc/GMT+7" . "GMT+7")
("Etc/GMT+8" . "GMT+8")
("Etc/GMT+9" . "GMT+9")
("Etc/GMT-0" . "GMT-0")
("Etc/GMT-1" . "GMT-1")
("Etc/GMT-10" . "GMT-10")
("Etc/GMT-11" . "GMT-11")
("Etc/GMT-12" . "GMT-12")
("Etc/GMT-13" . "GMT-13")
("Etc/GMT-14" . "GMT-14")
("Etc/GMT-2" . "GMT-2")
("Etc/GMT-3" . "GMT-3")
("Etc/GMT-4" . "GMT-4")
("Etc/GMT-5" . "GMT-5")
("Etc/GMT-6" . "GMT-6")
("Etc/GMT-7" . "GMT-7")
("Etc/GMT-8" . "GMT-8")
("Etc/GMT-9" . "GMT-9")
("Etc/GMT0" . "GMT0")
("Etc/Greenwich" . "Greenwich")
("Etc/UCT" . "UCT")
("Etc/Universal" . "Universal")
("Etc/UTC" . "UTC")
("Etc/Zulu" . "Zulu")
("Europe/Amsterdam" . "Amsterdam")
("Europe/Andorra" . "Andorra")
("Europe/Astrakhan" . "Astrakhan")
("Europe/Athens" . "Athens")
("Europe/Belfast" . "Belfast")
("Europe/Belgrade" . "Belgrade")
("Europe/Berlin" . "Berlin")
("Europe/Bratislava" . "Bratislava")
("Europe/Brussels" . "Brussels")
("Europe/Bucharest" . "Bucharest")
("Europe/Budapest" . "Budapest")
("Europe/Busingen" . "Busingen")
("Europe/Chisinau" . "Chisinau")
("Europe/Copenhagen" . "Copenhagen")
("Europe/Dublin" . "Dublin")
("Europe/Gibraltar" . "Gibraltar")
("Europe/Guernsey" . "Guernsey")
("Europe/Helsinki" . "Helsinki")
("Europe/Isle_of_Man" . "Isle_of_Man")
("Europe/Istanbul" . "Istanbul")
("Europe/Jersey" . "Jersey")
("Europe/Kaliningrad" . "Kaliningrad")
("Europe/Kiev" . "Kiev")
("Europe/Kirov" . "Kirov")
("Europe/Kyiv" . "Kyiv")
("Europe/Lisbon" . "Lisbon")
("Europe/Ljubljana" . "Ljubljana")
("Europe/London" . "London")
("Europe/Luxembourg" . "Luxembourg")
("Europe/Madrid" . "Madrid")
("Europe/Malta" . "Malta")
("Europe/Mariehamn" . "Mariehamn")
("Europe/Minsk" . "Minsk")
("Europe/Monaco" . "Monaco")
("Europe/Moscow" . "Moscow")
("Europe/Nicosia" . "Nicosia")
("Europe/Oslo" . "Oslo")
("Europe/Paris" . "Paris")
("Europe/Podgorica" . "Podgorica")
("Europe/Prague" . "Prague")
("Europe/Riga" . "Riga")
("Europe/Rome" . "Rome")
("Europe/Samara" . "Samara")
("Europe/San_Marino" . "San_Marino")
("Europe/Sarajevo" . "Sarajevo")
("Europe/Saratov" . "Saratov")
("Europe/Simferopol" . "Simferopol")
("Europe/Skopje" . "Skopje")
("Europe/Sofia" . "Sofia")
("Europe/Stockholm" . "Stockholm")
("Europe/Tallinn" . "Tallinn")
("Europe/Tirane" . "Tirane")
("Europe/Tiraspol" . "Tiraspol")
("Europe/Ulyanovsk" . "Ulyanovsk")
("Europe/Uzhgorod" . "Uzhgorod")
("Europe/Vaduz" . "Vaduz")
("Europe/Vatican" . "Vatican")
("Europe/Vienna" . "Vienna")
("Europe/Vilnius" . "Vilnius")
("Europe/Volgograd" . "Volgograd")
("Europe/Warsaw" . "Warsaw")
("Europe/Zagreb" . "Zagreb")
("Europe/Zaporozhye" . "Zaporozhye")
("Europe/Zurich" . "Zurich")
("Indian/Antananarivo" . "Antananarivo")
("Indian/Chagos" . "Chagos")
("Indian/Christmas" . "Christmas")
("Indian/Cocos" . "Cocos")
("Indian/Comoro" . "Comoro")
("Indian/Kerguelen" . "Kerguelen")
("Indian/Mahe" . "Mahe")
("Indian/Maldives" . "Maldives")
("Indian/Mauritius" . "Mauritius")
("Indian/Mayotte" . "Mayotte")
("Indian/Reunion" . "Reunion")
("Pacific/Apia" . "Apia")
("Pacific/Auckland" . "Auckland")
("Pacific/Bougainville" . "Bougainville")
("Pacific/Chatham" . "Chatham")
("Pacific/Chuuk" . "Chuuk")
("Pacific/Easter" . "Easter")
("Pacific/Efate" . "Efate")
("Pacific/Enderbury" . "Enderbury")
("Pacific/Fakaofo" . "Fakaofo")
("Pacific/Fiji" . "Fiji")
("Pacific/Funafuti" . "Funafuti")
("Pacific/Galapagos" . "Galapagos")
("Pacific/Gambier" . "Gambier")
("Pacific/Guadalcanal" . "Guadalcanal")
("Pacific/Guam" . "Guam")
("Pacific/Honolulu" . "Honolulu")
("Pacific/Johnston" . "Johnston")
("Pacific/Kanton" . "Kanton")
("Pacific/Kiritimati" . "Kiritimati")
("Pacific/Kosrae" . "Kosrae")
("Pacific/Kwajalein" . "Kwajalein")
("Pacific/Majuro" . "Majuro")
("Pacific/Marquesas" . "Marquesas")
("Pacific/Midway" . "Midway")
("Pacific/Nauru" . "Nauru")
("Pacific/Niue" . "Niue")
("Pacific/Norfolk" . "Norfolk")
("Pacific/Noumea" . "Noumea")
("Pacific/Pago_Pago" . "Pago_Pago")
("Pacific/Palau" . "Palau")
("Pacific/Pitcairn" . "Pitcairn")
("Pacific/Pohnpei" . "Pohnpei")
("Pacific/Ponape" . "Ponape")
("Pacific/Port_Moresby" . "Port_Moresby")
("Pacific/Rarotonga" . "Rarotonga")
("Pacific/Saipan" . "Saipan")
("Pacific/Samoa" . "Samoa")
("Pacific/Tahiti" . "Tahiti")
("Pacific/Tarawa" . "Tarawa")
("Pacific/Tongatapu" . "Tongatapu")
("Pacific/Truk" . "Truk")
("Pacific/Wake" . "Wake")
("Pacific/Wallis" . "Wallis")
("Pacific/Yap" . "Yap")
("US/Alaska" . "Alaska")
("US/Aleutian" . "Aleutian")
("US/Arizona" . "Arizona")
("US/Central" . "Central")
("US/East-Indiana" . "East-Indiana")
("US/Eastern" . "Eastern")
("US/Hawaii" . "Hawaii")
("US/Indiana-Starke" . "Indiana-Starke")
("US/Michigan" . "Michigan")
("US/Mountain" . "Mountain")
("US/Pacific" . "Pacific")
("US/Samoa" . "Samoa")
))
(time (read-from-minibuffer "Time HH:MM: "))
(city1 (ivy-completing-read "From timezone: " (mapcar 'cdr timezones)))
(city2 (ivy-completing-read "To timezone: " (mapcar 'cdr timezones)))
(day (read-from-minibuffer "Day 2025-01-30 (leave empty for today): "))
(tz1 (car (rassoc city1 timezones)))
(tz2 (car (rassoc city2 timezones))) ;gets key by value
(output (shell-command-to-string (format "python3 /etc/nixos/other-config/emacs/timezone/timezone-basis.py %s %s %s %s" time tz1 tz2 day))))
(message (format "%s" output))))

View file

@ -0,0 +1,49 @@
(defun zp/org-find-time-file-property (property &optional anywhere)
"Return the position of the time file PROPERTY if it exists.
When ANYWHERE is non-nil, search beyond the preamble."
(save-excursion
(goto-char (point-min))
(let ((first-heading
(save-excursion
(re-search-forward org-outline-regexp-bol nil t))))
(when (re-search-forward (format "^#\\+%s:" property)
(if anywhere nil first-heading)
t)
(point)))))
(defun zp/org-has-time-file-property-p (property &optional anywhere)
"Return the position of time file PROPERTY if it is defined.
As a special case, return -1 if the time file PROPERTY exists but
is not defined."
(when-let ((pos (zp/org-find-time-file-property property anywhere)))
(save-excursion
(goto-char pos)
(if (and (looking-at-p " ")
(progn (forward-char)
(org-at-timestamp-p 'lax)))
pos
-1))))
(defun zp/org-set-time-file-property (property &optional anywhere pos)
"Set the time file PROPERTY in the preamble.
When ANYWHERE is non-nil, search beyond the preamble.
If the position of the file PROPERTY has already been computed,
it can be passed in POS."
(when-let ((pos (or pos
(zp/org-find-time-file-property property))))
(save-excursion
(goto-char pos)
(if (looking-at-p " ")
(forward-char)
(insert " "))
(delete-region (point) (line-end-position))
(let* ((now (format-time-string "[%Y-%m-%d %a %H:%M]")))
(insert now)))))
(defun zp/org-set-last-modified ()
"Update the LAST_MODIFIED file property in the preamble."
(when (derived-mode-p 'org-mode)
(zp/org-set-time-file-property "LAST_MODIFIED")))
(add-hook 'before-save-hook #'zp/org-set-last-modified)

View file

@ -0,0 +1,28 @@
# #---------- Rsyncing Lemmy images -----------
rsync -avz --delete /home/misha/Nextcloud/InstantUpload/Connect/ /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/data/
cd /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/
echo "<html><head><title>Random images from the internet</title></head><body style='text-align: center'>" > /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/images.html
n=0
for file in $(ls -t data/*.{jpg,jpeg,gif,png}); do
[ -e "$file" ] || continue
((n%3==0)) && echo "<div style='width:100%; display: flex; justify-content: center;'>" >> /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/images.html
echo "<img src=\"$file\" style='max-width: 33.33%; object-fit: contain; border: 5px dotted black; margin: 0 auto;'>" >> /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/images.html
((n%3==2)) && echo "</div>" >> /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/images.html
let "n=n+1"
done
if ((n%3!=0)); then
echo "</div>" >> /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/images.html
fi
echo "</body></html>" >> /home/misha/Nextcloud/mishathings-website/static/public/pics_internet/images.html
# ------- Build website
echo "updating website"
cd /home/misha/Nextcloud/mishathings-website
hugo
#---------- Rsyncing website -----------
rsync -rav --delete /home/misha/Nextcloud/mishathings-website/public/ root@$(pass ip/transip)://var/www/mishathings.com

View file

@ -0,0 +1,12 @@
#+OPTIONS: toc:nil
* Mail
- This set-up works
- Tokens are of course not included in the git repo.
** IMAP
- Many thanks to [[https://github.com/goomens][Gerrit Oomens]]. See [[https://github.com/UvA-FNWI/M365-IMAP][here]].
- Every now and then the token expires.
- For a new token, run ~python3 get_token.py~
- Move new token to pass
** SMTP
- To create an encrypted token:
- python3 mutt_oauth2.py TOKEN_FILENAME --authorize (localhostauthcode)

View file

@ -0,0 +1,76 @@
# -*- mode: conf -*-
[general]
accounts = work, uva, transip, bij1
#accounts = work, transip, bij1
pythonfile = /etc/nixos/other-config/mail/imap/offlineimap.py
[Account transip]
localrepository = transip-Local
remoterepository = transip-Remote
[Account uva]
localrepository = uva-Local
remoterepository = uva-Remote
maxsize = 15000000
[Account bij1]
localrepository = bij1-Local
remoterepository = bij1-Remote
[Account work]
localrepository = work-Local
remoterepository = work-Remote
[Repository transip-Local]
type = Maildir
localfolders = ~/Maildir/transip/
[Repository uva-Local]
type = Maildir
localfolders = ~/Maildir/uva/
[Repository bij1-Local]
type = Maildir
localfolders = ~/Maildir/bij1/
[Repository work-Local]
type = Maildir
localfolders = ~/Maildir/work/
[Repository transip-Remote]
type = IMAP
remotehost = imap.transip.email
remoteuser = mail@mishavelthuis.nl
remotepasseval = get_pass("mail/mail@mishavelthuis.nl")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX','INBOX.Later','Archives.2023','Archives.2021','Archives.2020','Archives.2019','Drafts','Trash','Junk','news_info','uva.inbox-uva','uva.archive-uva','uva.concepten-uva','uva.archive-uva2024']
[Repository work-Remote]
type = IMAP
remotehost = imap.transip.email
remoteuser = work@mishavelthuis.nl
remotepasseval = get_pass("mail/work@mishavelthuis.nl")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX','Archive-5Feb2025-onwards']
[Repository bij1-Remote]
type = IMAP
remotehost = imap.transip.email
remoteuser = misha@bij1.org
remotepasseval = get_pass("mail/misha@bij1.org")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX','Drafts','Archief','Trash','Sent','Junk']
[Repository uva-Remote]
type = IMAP
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotehost = outlook.office365.com
remoteuser = m.velthuis@uva.nl
auth_mechanisms = XOAUTH2
oauth2_request_url = https://login.microsoftonline.com/common/oauth2/v2.0/token
oauth2_client_id = 08162f7c-0fd2-4200-a84a-f25a4db0b584
oauth2_client_secret = TxRBilcHdC6WGBee]fs?QR:SJ8nI[g82
oauth2_refresh_token_eval = get_token("mail/oauth2_token")
folderfilter = lambda folder: folder in ['INBOX','Concepten','archive-March252024-onwards']

View file

@ -0,0 +1,76 @@
# -*- mode: conf -*-
[general]
accounts = work, uva, transip, bij1
#accounts = work, transip, bij1
pythonfile = /etc/nixos/other-config/mail/imap/offlineimap.py
[Account transip]
localrepository = transip-Local
remoterepository = transip-Remote
[Account work]
localrepository = work-Local
remoterepository = work-Remote
[Account uva]
localrepository = uva-Local
remoterepository = uva-Remote
maxsize = 15000000
[Account bij1]
localrepository = bij1-Local
remoterepository = bij1-Remote
[Repository transip-Local]
type = Maildir
localfolders = ~/Maildir/transip/
[Repository work-Local]
type = Maildir
localfolders = ~/Maildir/work/
[Repository uva-Local]
type = Maildir
localfolders = ~/Maildir/uva/
[Repository bij1-Local]
type = Maildir
localfolders = ~/Maildir/bij1/
[Repository transip-Remote]
type = IMAP
remotehost = imap.transip.email
remoteuser = mail@mishavelthuis.nl
remotepasseval = get_pass("mail/mail@mishavelthuis.nl")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX']
[Repository work-Remote]
type = IMAP
remotehost = imap.transip.email
remoteuser = work@mishavelthuis.nl
remotepasseval = get_pass("mail/work@mishavelthuis.nl")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX']
[Repository bij1-Remote]
type = IMAP
remotehost = imap.transip.email
remoteuser = misha@bij1.org
remotepasseval = get_pass("mail/misha@bij1.org")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX']
[Repository uva-Remote]
type = IMAP
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotehost = outlook.office365.com
remoteuser = m.velthuis@uva.nl
auth_mechanisms = XOAUTH2
oauth2_request_url = https://login.microsoftonline.com/common/oauth2/v2.0/token
oauth2_client_id = 08162f7c-0fd2-4200-a84a-f25a4db0b584
oauth2_client_secret = TxRBilcHdC6WGBee]fs?QR:SJ8nI[g82
oauth2_refresh_token_eval = get_token("mail/oauth2_token")
folderfilter = lambda folder: folder in ['INBOX']

View file

@ -0,0 +1,4 @@
ClientId = "08162f7c-0fd2-4200-a84a-f25a4db0b584"
ClientSecret = "TxRBilcHdC6WGBee]fs?QR:SJ8nI[g82"
Scopes = ['https://outlook.office365.com/IMAP.AccessAsUser.All']
OutputFileName = "refresh_token"

Some files were not shown because too many files have changed in this diff Show more