Skip to content

Instantly share code, notes, and snippets.

View RhubarbSin's full-sized avatar

Rhubarb Sin RhubarbSin

  • Tampa, Florida, United States
View GitHub Profile
@RhubarbSin
RhubarbSin / macos-notes.org
Last active January 3, 2025 22:37
macOS Notes

macOS Notes

Configure macOS dock animation

  • Increase speed of dock animation
    defaults write com.apple.dock autohide-time-modifier -float 0.4; killall Dock
        
  • Remove dock animation
    defaults write com.apple.dock autohide-time-modifier -int 0; killall Dock
        
@RhubarbSin
RhubarbSin / install-terraform-amazon-linux-2023.sh
Last active December 9, 2024 05:53
Install Terraform on Amazon Linux 2023
#
# Install Terraform on Amazon Linux 2023
#
# Install plugin for DNF.
sudo dnf install --assumeyes 'dnf-command(config-manager)'
# Add Terraform repository.
sudo dnf config-manager \
--add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
# Install terraform package.
@RhubarbSin
RhubarbSin / oci-metadata.sh
Last active July 11, 2022 23:21
Get OCI compute instance metadata
curl http://169.254.169.254/opc/v1/instance/
curl -H "Authorization: Bearer Oracle" http://169.254.169.254/opc/v2/instance/
curl -H "Authorization: Bearer Oracle" http://169.254.169.254/opc/v2/instance/metadata/
curl -H "Authorization: Bearer Oracle" http://169.254.169.254/opc/v2/instance/metadata/<any-key-name>
@RhubarbSin
RhubarbSin / generate-ed25519-ssh-key.sh
Created May 1, 2022 16:24
Generate an Ed25519 SSH key
ssh-keygen -t ed25519 -a 200 -C "you@host" -f ~/.ssh/my_new_id_ed25519
@RhubarbSin
RhubarbSin / emacs-server-ssh-forwarding.org
Last active November 28, 2024 20:45
Use SSH to forward local Emacs server socket to remote host so emacsclient on remote host can open buffers in Emacs on local host
  • Get path of remote socket: execute on remote host
    emacs --batch --execute "(progn
            (require 'server)
            (princ (expand-file-name \"remote\" server-socket-dir)
                   #'external-debugging-output))"
        
  • Get path of local socket: execute on local host
    emacs --batch --execute "(progn
        
@RhubarbSin
RhubarbSin / emacs-28.1-amazon-linux-2022.sh
Last active May 1, 2022 16:25
Compile Emacs 28.1 on Amazon Linux 2022
sudo dnf -y install '@Development Tools' cmake gnutls-devel libgccjit-devel ncurses-devel wget
wget https://ftpmirror.gnu.org/emacs/emacs-28.1.tar.gz https://ftpmirror.gnu.org/emacs/emacs-28.1.tar.gz.sig
gpg --keyserver keyserver.ubuntu.com --recv-keys 17E90D521672C04631B1183EE78DAE0F3115E06B
gpg --verify emacs-28.1.tar.gz.sig
tar zxf emacs-28.1.tar.gz
cd emacs-28.1
./configure --with-native-compilation
make
src/emacs -Q
src/emacs --debug-init --chdir ~
@RhubarbSin
RhubarbSin / emacs-reference-use-package.org
Last active November 28, 2024 21:15
Reference for Emacs use-package macro

Reference for Emacs use-package macro

:init
Execute code before a package is loaded
  • Accepts one or more forms, up to the next keyword.
  • Example
    (use-package foo
      :init
      (setq foo-variable t))
            
@RhubarbSin
RhubarbSin / emacs-reference-straight.el.org
Last active November 28, 2024 21:01
Reference for Emacs straight package manager

Reference for Emacs straight package manager

Upgrading packages

straight-pull-package
Pull a single package to upgrade it to the latest version.
straight-pull-package-and-deps
Pull a package and all of its dependencies.
straight-pull-all
Upgrade all of your active packages.
straight-check-package
Activate the upgraded version of a package while Emacs is running.
straight-check-all
Check packages to see if their files have changed since the last build and rebuild them if necessary.
straight-rebuild-all
Unconditionally rebuild all packages.

Installing packages

#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::SSL;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(ssl_opts => {
verify_hostname => 0,
@RhubarbSin
RhubarbSin / blb-confluence.el
Last active November 11, 2021 04:36
Function for replacing contents of an Emacs Confluence buffer with text exported by org-confluence-export-as-confluence
(setq blb/confluence-page-sig "~/doc/confluence-rd-snippet.xml")
(defun blb/confluence-org-get-export ()
(interactive)
(confluence-toggle-page-content-type)
(let ((export-buffer (get-buffer "*org CONFLUENCE Export*")))
(buffer-swap-text export-buffer)
(kill-buffer export-buffer))
(confluence-toggle-page-content-type)
(save-excursion
(goto-char (point-max))