Skip to content

Instantly share code, notes, and snippets.

View akastrin's full-sized avatar
🎯
Focusing

Andrej Kastrin akastrin

🎯
Focusing
View GitHub Profile
@akastrin
akastrin / doom.txt
Created April 28, 2024 18:22 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@akastrin
akastrin / org-mobile-sync.el
Created January 20, 2024 10:15 — forked from tgdnt/org-mobile-sync.el
org-mobile-sync
;; org-mobile-sync
(defun org-mobile-clean-pre-push()
(with-temp-buffer
(shell-command "rm ~/mobileorg/*" t)))
(defun org-mobile-rclone-sync-post-push()
(with-temp-buffer
(shell-command "rclone sync ~/mobileorg Dropbox:Apps/MobileOrg --exclude \.DS_Store" t)))
(defun org-mobile-rclone-sync-pre-pull()
(with-temp-buffer
(shell-command "rm ~/mobileorg/*" t)
@akastrin
akastrin / gpg-ssh-setup.md
Created December 24, 2023 19:02 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@akastrin
akastrin / Readme.md
Created November 21, 2023 04:41 — forked from py7hon/Readme.md
How to disable the annoying speaker beep in Arch Linux

How to disable the annoying speaker beep in Arch Linux

This has been driving me crazy for a while, but I never did anything about it: Whenever I use the keyboard to delete a file in the file manager using the DEL key, or go back a directory using BACKSPACE, or some everyday task like that, the computer beeps really loud, and almost makes me jump out of my chair. Disabling the speaker in ALSA Mixer does not work, and setting the volume to zero also does not help. So here is how to get rid of that beep:

In a terminal, write:

$ xset -b
@akastrin
akastrin / titleUrlMarkdownClip.js
Created August 8, 2023 20:56 — forked from idelem/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;

Text Encoding

How are text files encoded, and what are the pros and cons of different encodings? This document introduces the ASCII and Unicode encodings to answer these questions. Some short pieces of Go code are provided which you can run yourself to see how strings are being encoded. Go is used because it has built-in support for Unicode, but you should be able to follow without any knowledge of Go.

ASCII

@akastrin
akastrin / renew-gpgkey.md
Created April 1, 2023 12:03 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

Scanning dependencies of target glog
Scanning dependencies of target gtest
Scanning dependencies of target faiss
[ 0%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/symbolize.cc.o
[ 0%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/logging.cc.o
[ 1%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/raw_logging.cc.o
[ 1%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/demangle.cc.o
[ 2%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/utilities.cc.o
[ 2%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/vlog_is_on.cc.o
[ 2%] Building CXX object third_party/glog/CMakeFiles/glog.dir/src/signalhandler.cc.o
~/.../tsne-cuda/build >>> cmake .. -DBUILD_PYTHON=TRUE -DWITH_MKL=FALSE -DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6 ±[master]
-- The C compiler identification is GNU 6.5.0
-- The CXX compiler identification is GNU 6.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-6 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
@akastrin
akastrin / oneliners.sh
Last active August 15, 2019 03:24
My oneliners
# Remove all packages younger than a specified date
xargs -a <(expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort -n | awk -F"\t" -v "Date=$(date -d'2019-08-14 12:52:00' '+%Y-%m-%d %H:%M:%S')" '$1 > Date {print $0}' | cut -f2) sudo pacman -R