Add a bunch of nix and python snippets

This commit is contained in:
Evie Litherland-Smith 2024-02-22 11:08:19 +00:00
parent 08ae11ed72
commit c318479bed

View file

@ -151,11 +151,74 @@ org-mode
(elisp "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code))
(inlsrc "src_" p "{" q "}")
nix-mode
(buildphase > "buildPhase= ''" n (p "Build Instructions") n " '';")
(checkPhase > "checkPhase= ''" n (p "") n " '';")
(configurephase > "configurePhase= ''" n (p "") n " '';")
(fixupphase > "fixupPhase= ''" n (p "") n " '';")
(distphase > "distPhase= ''" n (p "") n " '';")
(patchphase > "patchPhase= ''" n (p "") n " '';")
(unpackphase > "unpackPhase= ''" n (p "") n " '';")
(installCheckPhasephase > "installCheckPhasePhase= ''" n (p "") n " '';")
(installphase > "installphase= ''" n p " mkdir -p $out/bin" n> "for f in $(find . -executable -type f);" n> "do" n> "cp $f $out/bin" n> "done}" n> " '';")
(gitpackage "{ lib" n ", stdenv" n ", fetchFromGitHub" n ", " (p "inputs") n ", " (p "inputs") n "}:" n n>
"stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n>
"src = fetchFromGitHub {" n> "owner = \"" (p "" own) "\";" n> "repo = \"" (s pkgn) "\";" n>
"rev = \"" "v${version}" "\";" n> "sha256 = \"" "${lib.fakeSha256}" "\";" n> "};" n n>
"nativeBuildInputs = [ " (p "makeWrapper") " ];" n n> "BuildInputs = [ " (p) " ];" n n>
"meta = with lib; {" n>
"homepage = \"" "https://github.com/" (s own) "/" (s pkgn) "\";" n>
"description = \"" (p) "\";" n>
"license = licenses." (p (completing-read "License: " '("agpl3" "asl20" "bsd1" "bsd2" "bsd3" "free" "gpl2" "gpl2Only" "gpl2Plus" "gpl3" "gpl3Only" "gpl3Plus" "isc" "lgpl21Only" "lgpl21Plus" "lgpl2Only" "lgpl2Plus" "lgpl3" "lgpl3Only" "mit" "mpl20" "ofl" "unfree"))) ";" n>
"maintainers = with maintainers; [ " (s own) " ];" n>
"platforms = platforms."
(p (completing-read "Platform: " '("all" "allBut" "arm" "cygwin" "darwin" "freebsd" "gnu" "i686" "illumos" "linux" "mesaPlatforms" "mips" "netbsd" "none" "openbsd" "unix" "x86"))) ";" n> q "};" n> "}"
)
python-base-mode
(main "def main(" (p "*args, **kwargs") ") -> " (p "None") ":" n > q "return")
(ifmain "if __name__ == \"__main__\":" n > "main()")
(clss "class " (p "Class") "(" p "):"
n> q)
(defi "def __init__(self" (p ", *args, **kwargs") ") -> None:"
n> "\"\"\"" (p "docstring") "\"\"\""
n> q "pass")
(defm "def " (p "method") "(self" (p ", *args, **kwargs") ") -> " (p "None") ":"
n> "\"\"\"" (p "docstring") "\"\"\""
n> q "return")
(defc "@classmethod"
n> "def " (p "classmethod") "(cls" (p ", *args, **kwargs") ") -> " (p "None") ":"
n> "\"\"\"" (p "docstring") "\"\"\""
n> q "return")
(defs "@staticmethod"
n> "def " (p "staticmethod") "(" (p "*args, **kwargs") ") -> " (p "None") ":"
n> "\"\"\"" (p "docstring") "\"\"\""
n> q "return")
(deff "def " (p "func") "(" (p "*args, **kwargs") ") -> " (p "None") ":"
n> "\"\"\"" (p "docstring") "\"\"\""
n> q "return")
(main "def main(" (p "*args, **kwargs") ") -> " (p "None") ":"
n> q "return")
(ifm "if __name__ == \"__main__\":"
n> "main()")
(scr "#!/usr/bin/env python3"
n
n> "def main() -> None:"
n> "pass"
n
n> "if __name__ == \"__main__\":"
n> "main()")
(logg "logger = logging.getLogger(__name__)")
(nimp "raise NotImplementedError")
(args "def parse_arguments() -> argparse.Namespace:" n>
"parser = argparse.ArgumentParser(description=\"" p "\")" n>
p n>
"return parser.parse_args()")
(regx p " = re.compile(r\"" p "\")")
(bang "#!/usr/bin/env python3" n> q)
(utf-8_encoding "# -*- coding: utf-8 -*-")
;; Local Variables:
;; mode: lisp-data