Skip to content

Instantly share code, notes, and snippets.

@grafov
grafov / magit-commit-and-rebase-fixup.el
Last active July 21, 2025 22:26
Create a temporary commit from the staged changes and merge it with the previous commit. Comments in Russian and Esperanto but I think translation is not a problem nowadays )
(defun my-magit-commit-and-rebase-fixup ()
"Создать временный коммит из staged изменений и объединить с предыдущим коммитом."
(interactive)
;; Проверяем наличие staged изменений
(when (not (magit-anything-staged-p))
(user-error "Nenio ŝanĝoj estas en la 'staged'"))
;; Проверяем наличие коммитов в истории
(when (not (magit-rev-verify "HEAD"))
(user-error "Nenio ŝanĝoj estas en la historio"))
@grafov
grafov / magit-backup-branch.el
Created July 17, 2025 18:29
Backup current Git branch with predefined name based on the date.
(defun my-magit-backup-branch ()
"Backup current Git branch with predefined name based on the date."
(interactive)
(let* ((current-branch (magit-get-current-branch))
(branch-name (format "backup-%s-%s" current-branch (format-time-string "%y-%m-%d-%H-%M" (current-time)))))
(magit-run-git "branch" "-d" branch-name)
(magit-run-git "checkout" "-b" branch-name current-branch)
(magit-run-git "push" "--force" "origin" branch-name)
(magit-checkout current-branch)))
@grafov
grafov / magit-push-as-another-branch.el
Last active July 21, 2025 22:27
Recreate a Magit branch by deleting and creating a new one with branch name completion. I need this flow very often at my work for pushing changes to the special branches that deploy the code to test environments.
(defun my-magit-push-as-another-branch ()
"Recreate a Magit branch by deleting and creating a new one with branch name completion."
(interactive)
(let* ((branches (split-string (car (magit-git-items "for-each-ref" "--format=%(refname:short)" "refs/heads/")) "\n"))
(branch-name (ivy-read "Enter branch name: " branches
:require-match t
:preselect (magit-get-current-branch)
:sort nil))
(current-branch (magit-get-current-branch)))
(when (yes-or-no-p (format "Recreate & push branch \"%s\"?" branch-name))
@itz-Jana
itz-Jana / blog_list.md
Last active August 6, 2025 07:23
List of websites and blogs from people on the Fediverse. This is merely a collection of all links, I have not yet looked at any of them.

g.co, Google's official URL shortcut (update: or Google Workspace's domain verification, see bottom), is compromised. People are actively having their Google accounts stolen.

Someone just tried the most sophisticated phishing attack I've ever seen. I almost fell for it. My mind is a little blown.

  1. Someone named "Chloe" called me from 650-203-0000 with Caller ID saying "Google". She sounded like a real engineer, the connection was super clear, and she had an American accent. Screenshot.

  2. They said that they were from Google Workspace and someone had recently gained access to my account, which they had blocked. They asked me if I had recently logged in from Frankfurt, Germany and I said no.

  3. I asked if they can confirm this is Google calling by emailing me from a Google email and they said sure and sent me this email and told me to look for a case number in it, which I saw in

Mastodon for people who are new to social media

In this blog post, I try to explain Mastodon to people who are not familiar with social media and/or beginner computer users. I try to be as jargon-free as I can.

Structure of this blog post:

  • Reading section 1 and 2 takes a bit of effort: They explain important background knowledge for Mastodon. But, in my opinion, the effort is worth it because you’ll find it much easier to use Mastodon. Not having this knowledge can prevent even otherwise advanced computer users from enjoying Mastodon.

  • Section 3 is brief and mentions first steps for actually getting started with Mastodon.

@zondo
zondo / conditional-tangle.org
Last active August 8, 2025 14:36
Conditional tangling in org mode based on tags

Conditional Tangling based on Tags

I recently came across a little-known (to me, anyway) feature of org mode, thanks to this mailing list reply: conditional tangling. In the :tangle argument, as well as the standard values (yes, no or a filename string), you can also set it dynamically, by specifying an elisp expression which evaluates to the tangle setting.

This is quite useful together with tags. Here’s a function which sets the argument based on which tags are currently set in the file:

@noah-evans
noah-evans / emacs-guix-setup.org
Last active July 18, 2025 09:22
Using the guix package manager for a cross-distro, reproducible emacs environment.

Using the guix package manager for a cross-distro, reproducible emacs environment

GNU guix is a functional package manager, that can be installed on any distribution and used to manage packages, including emacs packages.

How is this different from straight.el

straight.el is also a functional package manager, but unlike guix, it only manages emacs packages, while with guix you can include external programs that you will make use of from emacs (like ripgrep), emacs

;; Inspired by this blog post on "let's surround":
;; https://arialdomartini.github.io/emacs-surround-2 and
;; https://www.emacswiki.org/emacs/SurroundRegion.
;;
;; Notable bits:
;;
;; - Specifying =open= as a default value in the closing delimiter completing
;; read -- that allows the user to hit return to re-use the opening
;; delimiter for the closing one.
;; - This moves point accordingly, so that you can make repeated calls to
@jensgro
jensgro / 11ty-conference-videos.md
Created May 24, 2024 14:06
The videos of the first online conference of the 11ty-community - in schedule order.