Skip to content

Instantly share code, notes, and snippets.

View Eason0210's full-sized avatar
🎯
Focusing

Eason Huang Eason0210

🎯
Focusing
View GitHub Profile
@Eason0210
Eason0210 / repeat-change-cursor-color.el
Created June 14, 2024 14:16 — forked from jdtsmith/repeat-change-cursor-color.el
Emacs: change cursor color during active repeat-mode commands
(let ((orig (default-value 'repeat-echo-function))
rcol ccol in-repeat)
(setq
repeat-echo-function
(lambda (map)
(if orig (funcall orig map))
(unless rcol (setq rcol (face-foreground 'error)))
(if map
(unless in-repeat ; new repeat sequence
(setq in-repeat t
@Eason0210
Eason0210 / run-psql.ps1
Created June 13, 2023 05:18 — forked from MasFlam/run-psql.ps1
PowerShell script to run psql prompting for connection details
Write-Host "Enter connection details:"
$server = "localhost"
$server_maybe = (Read-Host -Prompt "Server [$server]")
If($server_maybe -ne "") {
$server = $server_maybe
}
$db = "postgres"
@Eason0210
Eason0210 / how-to.txt
Created November 11, 2022 15:23 — forked from simonw/how-to.md
How to create a tarball of a git repository using "git archive"
git archive --format=tar.gz -o /tmp/my-repo.tar.gz --prefix=my-repo/ master
@Eason0210
Eason0210 / nix-on-macos-catalina.md
Created September 22, 2021 15:19 — forked from chriselsner/nix-on-macos-catalina.md
Nix on macOS Catalina

Nix on macOS Catalina

I'm writing this gist for my own records but it might help someone else too.

Installing Nix

Support for Catalina has improved a lot since the update was first rolled out.

Note: See the NixOS manual for discussion of the --darwin-use-unencrypted-nix-store-volume option.

# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@Eason0210
Eason0210 / MyEmacsKeymap.ahk
Created June 30, 2020 13:57 — forked from tado/MyEmacsKeymap.ahk
My Emacs-like Keybindings for AutoHotKey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MyEmacsKeymap.ahk
;; - An AutoHotkey script to simulate Emacs keybindings on Windows
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Settings for testing
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; enable warning
;#Warn All, MsgBox
@Eason0210
Eason0210 / auto-python-venv.md
Created February 19, 2020 12:58 — forked from purcell/auto-python-venv.md
Sane automatic python + virtualenv

Automatic python version plus venv

Goal

For easy editor integration and command-line usage, we'd like to be able to specify a Python version per project, with its own virtualenv to isolate its libraries from those of other projects.

We're willing to change $PATH globally once, but not per project. And we'd like to avoid having to run every python command invocation in a special subshell created by a shell wrapper. Instead, simply invoking "python" or "pip" etc. should do the right thing, based on the directory in which it is invoked.

It turns out this is possible!