Skip to content

Instantly share code, notes, and snippets.

View grafov's full-sized avatar
🫖
HTTP 418

Alexander I.Grafov grafov

🫖
HTTP 418
View GitHub Profile
@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))
@grafov
grafov / keymap.c
Last active September 9, 2024 10:25
How to implement "SNAP TAP" like feature on QMK keyboard
// Not for copypaste! It is only part of keymap.c!
// You should adapt the code above for your keyboard especially for your layers.
// WARNING! You could be banned in Valve games because the feautre treated by Valve as a cheat.
//
// It uses two user hooks: layer_state_set_user() and process_record_user() as defined by QMK.
// Example enum with layers.
enum layers {
DEFAULT_LAYER,
GAME_LAYER,
@Thomashighbaugh
Thomashighbaugh / installing-brave-on-void-linux.md
Created December 27, 2021 21:16
For anyone trying to install Brave Browser on Void Linux, cross-post from Reddit

Installing Brave Browser on Void Linux

For anyone curious in the future:

Yes, you can relatively easily install brave browser on void linux, if that is somehow a non-negotiable for you fear not. There are three methods that I am aware of:

  1. Add this template file to your fork of void-packages locally and build the ./xbps-src package like any other.

  2. Use flatpak, which I need not explain since instructions are on the flathub listing itself. (Note: will be isolated from the system which can be a bit of a pain, especially using things like keepassxc)

@AlexxIT
AlexxIT / yandex_station_call.md
Last active February 25, 2025 22:58
Звонок на колонку с Алисой

Создаём в Home Assistant карточку для быстрого звонка на колонку.

  1. Можно создать или просто карточку-кнопку:
type: button
icon: 'mdi:phone-classic'
tap_action:
  action: url
  # Яндекс > Устройства > Колонка > Дополнительная информация > Идентификатор устройства (регистр важен)
@dnlvgl
dnlvgl / 90-kensington-expert-trackball-remap.hwdb
Created January 25, 2020 23:03
Remapping Kensington Expert Trackball Buttons with wayland
# Button remap for Kensington Expert Trackball
# both upper buttons (90003 + 90004) act as BTN_LEFT (272)
# both lower buttons (90001 + 90002) act as BTN_RIGHT (273)
# save this file under '/etc/udev/hwdb.d/90-kensington-expert-trackball-remap.hwdb'
# run `sudo systemd-hwdb update` and reboot
#
# source: https://askubuntu.com/questions/1145057/remapping-mouse-buttons-to-keyboard-keys
# /sys/class/input/event20/device/id/bustype:0003
# /sys/class/input/event20/device/id/product:1020
# /sys/class/input/event20/device/id/vendor:047d
@eliasnaur
eliasnaur / grid.go
Last active April 29, 2023 19:43
Gio Grid example using Flex
package main
import (
"image"
"gioui.org/app"
"gioui.org/f32"
"gioui.org/io/system"
"gioui.org/layout"
"gioui.org/op/paint"
@psanford
psanford / gopls-config.el
Last active June 23, 2022 20:48
gopls (go lsp-mode) config for emacs with useful optional packages.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Pre gopls/lsp-mode/go-mode setup
;;; This section installs use-package from melpa if it isn't
;;; already installed. You can skip this if you already have use-package
;; enable melpa if it isn't enabled
(require 'package)
(when (not (assoc "melpa" package-archives))
(setq package-archives (append '(("melpa" . "https://melpa.org/packages/")) package-archives)))
(package-initialize)
@jumper047
jumper047 / qutemacs.py
Created November 15, 2018 21:28
Qutebrowser config with emacs key bindings
# qutemacs - a simple, preconfigured Emacs binding set for qutebrowser
#
# The aim of this binding set is not to provide bindings for absolutely
# everything, but to provide a stable launching point for people to make their
# own bindings.
#
# Installation:
#
# 1. Copy this file or add this repo as a submodule to your dotfiles.
# 2. Add this line to your config.py, and point the path to this file: