Skip to content

Instantly share code, notes, and snippets.

View akastrin's full-sized avatar
🎯
Focusing

Andrej Kastrin akastrin

🎯
Focusing
View GitHub Profile
@py7hon
py7hon / Readme.md
Created July 28, 2019 20:05
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
@kepi
kepi / org-archive-subtree-hierarchical.el
Last active October 12, 2024 23:09
Hierarchical archiving for Org-mode
;; org-archive-subtree-hierarchical.el
;;
;; version 0.2
;; modified from https://lists.gnu.org/archive/html/emacs-orgmode/2014-08/msg00109.html
;; modified from https://stackoverflow.com/a/35475878/259187
;; In orgmode
;; * A
;; ** AA
;; *** AAA
@braunm
braunm / RLatex.md
Last active April 20, 2023 07:01
Integrating emacs, ESS, knitr, and polymode

New pattern for R code chunks in knitr

I use emacs/ESS to write LaTeX documents that embed R code. One of the nice features of emacs is the preview-latex package (part of AucTeX), which typesets LaTeX math directly in the emacs frame. However, preview-latex chokes when it encounters R code chunks, meaning I cannot preview LaTeX math in Rnw files.

My goal is to define a LaTeX environment, Rcode, with the following properties:

@tgdnt
tgdnt / org-mobile-sync.el
Last active January 20, 2024 10:15
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)
@mschecht
mschecht / Current programming workflow - Python
Last active June 5, 2024 10:33
Use Jupyter Lab on a remote server
# Python programming setup
- Desc: This is my current workflow for setting up my Python programming interface
with Jupyter lab on a remote server. I will be setting up Jupyter lab on the
remote server to be constantly running. After this has been completed once, only
step 5-6 are needed to connect my local computer to the running Jupyter lab.
- Benefits:
- Now I get to develope locally using the Jupyter Lab interface but run
calculations on remotely on the servers :)
@alexandrehuat
alexandrehuat / macros.tex
Last active March 13, 2025 12:25
My LaTeX macros
\usepackage{todonotes}
%%% Maths commands
\usepackage{amsmath,amssymb,amsthm,mathtools,cool}
% Naturals, reals, etc.
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\I}{\mathbb{I}}
@ansulev
ansulev / arch-install-dual-encrypted-t480s.sh
Last active March 20, 2023 16:18
Install UEFI Arch Linux dual boot with Windows 10 on Thinkpad T480s. Full encrypted btrfs subvolume inside luks. UEFI and Secure Boot enabled.
# Install Arch Linux dual boot with Windows 10 on Thinkpad T480s. Dec 2018.
# Full encrypted btrfs subvolume inside luks. UEFI and Secure Boot enabled.
# filename: install-arch-linux-on-btrfs-subvolume-inside-luks.txt
# The official guide: https://wiki.archlinux.org/index.php/Installation_Guide
# Last edit: 2021/10/11 (Work in priogress...)
# Shrink Windows partition to make room for the linux.
# Remove BitLocker encryption and Fast Boot. After install can re-enable BitLocker.
# Need to setup again Bitlocker, PIN, Fingerprint (tested on Win10 1803)
@alecgerona
alecgerona / dual_boot_arch_windows.md
Last active March 21, 2024 11:46
Dual Boot install Arch Linux in a Windows 10 preinstalled laptop

Notes: This install was done on MSI GL62M 7REX, ASUS FX503v, and Lenovo Y540 laptops and doesn't implement a secured partition for simplicity and ease of use. Use at your own discretion.

Since the laptop has an SSD, I'd like to install Arch Linux on the SSD as well. Unfortunately, Windows' installation has the whole drive occupied so it needs to be shrunk

  1. Boot into Windows and go into "Create and format hard disk partitions" in Control Panel.
  2. Free up some space in the SSD.

At this point we now have an unallocated disk space. We need to make this space usable by making it of file system type RAW

  1. While still in the Disk Management window, select the unallocated space and create a simple volume in it. Don't assign a path/letter to it, use the whole space, and don't format the drive.
@mrkgnao
mrkgnao / ghostscript-pdf-crop.sh
Created October 8, 2018 16:32
Crop pdfs with GhostScript
#!/usr/bin/env bash
set -euo pipefail
origdir=$(pwd)
tmpdir=$(mktemp -d)
echo "tmpdir: $tmpdir"
read -r width height < <(pdfinfo $1 | grep "Page size:" | sed 's/[a-zA-Z: ]*\([0-9]\+\)[x ]*\([0-9]\+\).*/\1 \2/')
npages=$(pdfinfo $1 | grep "Pages:" | sed 's/Pages: \+\([0-9]\+\).*/\1/')
echo "page count: $npages"
echo "(width, height) = ($width, $height)"
@krisleech
krisleech / renew-gpgkey.md
Last active October 6, 2025 20:21
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: