Long time, no commits

This commit is contained in:
Willem van den Ende
2021-03-21 21:03:22 +00:00
parent 3e1e5ec7e1
commit 84baf90147
7 changed files with 245 additions and 4 deletions
+87
View File
@@ -59,3 +59,90 @@
;; ;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented. ;; they are implemented.
;;
(setq evil-move-cursor-back nil)
;;
;; from https://github.com/org-roam/org-roam-server/issues/115
;; but modified the open to browse-url-button-open-url
(use-package org-roam-server
:config
(setq org-roam-server-host "127.0.0.1"
org-roam-server-port 8427
org-roam-server-authenticate nil
org-roam-server-export-inline-images t
org-roam-server-serve-files nil
org-roam-server-served-file-extensions '("pdf" "mp4" "ogv")
org-roam-server-network-poll t
org-roam-server-network-arrows nil
org-roam-server-network-label-truncate t
org-roam-server-network-label-truncate-length 60
org-roam-server-network-label-wrap-length 20))
(defun org-roam-server-open ()
"Ensure the server is active, then open the roam graph."
(interactive)
(org-roam-server-mode 1)
(browse-url-button-open-url (format "http://localhost:%d" org-roam-server-port)))
(after! org-roam
(org-roam-server-mode))
;; two functions from:
;; https://zzamboni.org/post/my-emacs-configuration-with-commentary/#reformatting-an-org-buffer
(defun zz/org-reformat-buffer ()
(interactive)
(when (y-or-n-p "Really format current buffer? ")
(let ((document (org-element-interpret-data (org-element-parse-buffer))))
(erase-buffer)
(insert document)
(goto-char (point-min)))))
(defun afs/org-remove-link ()
"Replace an org link by its description or if empty its address"
(interactive)
(if (org-in-regexp org-link-bracket-re 1)
(let ((remove (list (match-beginning 0) (match-end 0)))
(description (if (match-end 3)
(org-match-string-no-properties 3)
(org-match-string-no-properties 1))))
(apply 'delete-region remove)
(insert description))))
(defun qwan/org-replace-link-by-link-description ()
"Remove the link part of an org-mode link at point and keep
only the description"
(interactive)
(let ((elem (org-element-context)))
(if (eq (car elem) 'link)
(let* ((content-begin (org-element-property :contents-begin elem))
(content-end (org-element-property :contents-end elem))
(link-begin (org-element-property :begin elem))
(link-end (org-element-property :end elem)))
(if (and content-begin content-end)
(let ((content (buffer-substring-no-properties content-begin content-end)))
(delete-region link-begin (- link-end 1))
(insert content)))))))
(bind-key "C-c r" 'qwan/org-replace-link-by-link-description)
(defun org-roam-replace-file-link-by-website-or-description ()
"If a linked org-roam file has a website as key, use that as the link target instead of the filename. Otherwise, remove the link, and leave just
the description. This may destroy existing links, or change their targets so use in a copy of buffers you hold dearly as notes"
(interactive)
(let ((elem (org-element-context)))
(if (eq (car elem) 'link)
(let* ((content-begin (org-element-property :contents-begin elem))
(content-end (org-element-property :contents-end elem))
(target-type (org-element-property :type elem))
(target-path (org-element-property :path elem))
(link-begin (org-element-property :begin elem))
(link-end (org-element-property :end elem)))
(if (and content-begin content-end (string-equal target-type "file") target-path link-begin link-end)
(let ((new-link (org-roam-description-file-to-org-url
(buffer-substring-no-properties content-begin content-end)
target-path)))
(delete-region link-begin (- link-end 1))
(insert new-link)
))))))
+1
View File
@@ -10,3 +10,4 @@
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
) )
(put 'downcase-region 'disabled nil)
+7 -4
View File
@@ -14,6 +14,9 @@
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its ;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code). ;; directory (for easy access to its source code).
;; Regular configuration
;;
(doom! :input (doom! :input
;;chinese ;;chinese
;;japanese ;;japanese
@@ -76,7 +79,7 @@
;;eshell ; the elisp shell that works everywhere ;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs ;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs ;;term ; basic terminal emulator for Emacs
;;vterm ; the best terminal emulation in Emacs vterm ; the best terminal emulation in Emacs
:checkers :checkers
syntax ; tasing you for every semicolon you forget syntax ; tasing you for every semicolon you forget
@@ -87,7 +90,7 @@
;;ansible ;;ansible
;;debugger ; FIXME stepping through code, to help you add bugs ;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv ;;direnv
;;docker docker
;;editorconfig ; let someone else argue about tabs vs spaces ;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs ;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
@@ -146,7 +149,7 @@
;;nim ; python + lisp at the speed of c ;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!" ;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel ;;ocaml ; an objective camel
(org +roam ) ; organize your plain life in plain text (org +roam +download-dnd) ; organize your plain life in plain text
;;php ; perl's insecure younger brother ;;php ; perl's insecure younger brother
plantuml ; diagrams for confusing people more plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional ;;purescript ; javascript, but functional
@@ -166,7 +169,7 @@
;;swift ; who asked for emoji variables? ;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance. ;;terra ; Earth and Moon in alignment for performance.
;;web ; the tubes ;;web ; the tubes
;;yaml ; JSON, but readable yaml ; JSON, but readable
:email :email
;;(mu4e +gmail) ;;(mu4e +gmail)
@@ -0,0 +1,55 @@
# key: __codebuild.json
# name: AWS CodeBuild json config
# --
{
"name": "$1",
"arn": "arn:aws:codebuild:eu-central-1:123456789012:project/$2"
"description": "$3",
"source": {
"type": "CODEPIPELINE",
"insecureSsl": false
},
"secondarySourceVersions": [],
"artifacts": {
"type": "CODEPIPELINE",
"name": "$4",
"packaging": "NONE",
"encryptionDisabled": false
},
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/standard:5.0",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": [
{
"name": "AWS_DEFAULT_REGION",
"value": "eu-central-1",
"type": "PLAINTEXT"
}
],
"privilegedMode": true,
"imagePullCredentialsType": "CODEBUILD"
},
"serviceRole": "arn:aws:iam::123456789012:role/ExampleCodeBuildServiceRole",
"timeoutInMinutes": 60,
"queuedTimeoutInMinutes": 480,
"encryptionKey": "arn:aws:kms:eu-central-1:123456789012:alias/aws/s3",
"tags": [$5],
"badge": {
"badgeEnabled": false
},
"logsConfig": {
"cloudWatchLogs": {
"status": "ENABLED"
},
"s3Logs": {
"status": "DISABLED",
"encryptionDisabled": false
}
},
"fileSystemLocations": [],
"concurrentBuildLimit": 1
}
+55
View File
@@ -0,0 +1,55 @@
# key: __codebuild.json
# name: AWS CodeBuild json config
# --
{
"name": "course-vendingmachine-cs",
"arn": "arn:aws:codebuild:eu-central-1:123456789012:project/$1"
"description": "$2",
"source": {
"type": "CODEPIPELINE",
"insecureSsl": false
},
"secondarySourceVersions": [],
"artifacts": {
"type": "CODEPIPELINE",
"name": "$3",
"packaging": "NONE",
"encryptionDisabled": false
},
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/standard:5.0",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": [
{
"name": "AWS_DEFAULT_REGION",
"value": "eu-central-1",
"type": "PLAINTEXT"
}
],
"privilegedMode": true,
"imagePullCredentialsType": "CODEBUILD"
},
"serviceRole": "arn:aws:iam::123456789012:role/ExampleCodeBuildServiceRole",
"timeoutInMinutes": 60,
"queuedTimeoutInMinutes": 480,
"encryptionKey": "arn:aws:kms:eu-central-1:123456789012:alias/aws/s3",
"tags": [$4],
"badge": {
"badgeEnabled": false
},
"logsConfig": {
"cloudWatchLogs": {
"status": "ENABLED"
},
"s3Logs": {
"status": "DISABLED",
"encryptionDisabled": false
}
},
"fileSystemLocations": [],
"concurrentBuildLimit": 1
}
+12
View File
@@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# name: jekyll blog post
# key: jekyll_post
# --
---
layout: post
title: $0
tags:
- $1
author: Willem van den Ende
image: $2
---
+28
View File
@@ -0,0 +1,28 @@
# -*- mode: yaml -*-
# name: AWS CodeBuild buildspec
# key: buildspec
# --
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.eu-central-1.amazonaws.com
- REPOSITORY_URI=123456789012.dkr.ecr.eu-central-1.amazonaws.com/example/$1
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG