Skip to content

Instantly share code, notes, and snippets.

@naokton
naokton / osascript.js
Created December 21, 2020 02:09
Alfred Workflow Sample - Search Wikipedia by DOM Operation
function run(){
let url = 'https://en.wikipedia.org/wiki/Main_Page'
let word = "{query}"
let app = Application("Safari")
app.includeStandardAdditions = true
app.activate()
let tab = loadUrlNewTab(app, url)
waitPageLoad(app, tab)
searchWord(app, tab, word)
@naokton
naokton / rebuild-libvterm.sh
Created December 13, 2020 04:41
Rebuild libvterm for Apple Silicon Mac (aarch64)
#!/bin/bash
/opt/homebrew/bin/brew install cmake libtool
cd ~/.emacs.d/elpa/vterm-[0-9]*
rm -rf build vterm-module.so
mkdir build
cd build
/opt/homebrew/bin/cmake -DUSE_SYSTEM_LIBVTERM=no ..
make
@naokton
naokton / build-emacs-aarch64.sh
Last active October 2, 2021 02:02
Build Emacs 27.1 (--with-ns / GUI) on Apple Silicon Mac (aarc64) with Homebrew
#!/bin/bash
if [ ! -f /opt/homebrew/bin/brew ]; then
echo "Install ARM homebrew to /opt/homebrew"
exit
fi
message() {
TIME=$(date "+%Y-%m-%dT%H:%M:%S")
MSG=$@
echo "$TIME | $MSG"
@naokton
naokton / path.sh
Created February 13, 2020 21:58
Add npm local path (Usage: source path.sh)
export PATH=$(cd $(dirname $0); pwd)/node_modules/.bin:$PATH