Skip to content

Instantly share code, notes, and snippets.

@pwang2
pwang2 / init.lua
Last active February 5, 2024 21:16
neovim init.lua
-- vm: ft=lua ts=2 sw=2 expandtab
vim.loader.enable()
local config_path = vim.fn.stdpath('config')
local gist_map_table = {
['33797ca5e8eec8c4ac32c79c05b9b499'] = 'init-prev.vim',
['72cbbb413ef272e29cf912d5a7de67ad'] = 'lua/nvim-tree-config.lua',
['5660dd151ecc9ae091e418d1e4239e2b'] = 'lua/startup-screen.lua',
['e1d1a276c4746fc034a2eb6bb2a594db'] = 'lua/nvim-cmp-config.lua',
['075c027cc334550046b75cc58ba44fb9'] = 'lua/nvim-lsp-config.lua'
@pwang2
pwang2 / colortest
Last active January 22, 2022 22:46
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
import json
from datetime import date, datetime
from functools import cache
from http.client import HTTPConnection
import pytz
from azure.storage.blob import BlobServiceClient, __version__
CONTAINER_NAME = "overrides"
CONSTR_FROM = ""
# -*- mode: sh; -*-
# Dracula Theme v1.2.5
#
# https://github.com/dracula/dracula-theme
#
# Copyright 2019, All rights reserved
#
# Code licensed under the MIT license
# http://zenorocha.mit-license.org
@pwang2
pwang2 / init.lua
Last active December 19, 2022 02:28
hammerspoon init file
-- https://www.hammerspoon.org/Spoons/SpoonInstall.html
hs.loadSpoon("SpoonInstall")
-- spoon.SpoonInstall:installSpoonFromZipURL("https://github.com/scottwhudson/Lunette/blob/master/Spoons/Lunette.spoon.zip?raw=true")
-- hs.loadSpoon("Lunette")
-- spoon.Lunette:bindHotkeys()
spoon.SpoonInstall:andUse("ReloadConfiguration")
spoon.ReloadConfiguration:start()
local function changeVolume(diff)
# https://github.com/alacritty/alacritty/blob/master/alacritty.yml
live_config_reload: true
shell:
program: /bin/zsh
args:
- --login
- -c
- "tmux a || tmux -2"
@pwang2
pwang2 / preexec-display
Last active May 13, 2020 16:02
preexec to sync DISPLAY env
function preexec {
if [ -n "$TMUX" ]; then
export DISPLAY=$(tmux show-environment | grep -oP "(?<=SSH_CLIENT=)[\d\.]*"):0.0
else
export DISPLAY=$(env | grep -oP "(?<=SSH_CLIENT=)[\d\.]*"):0.0
fi
}
@pwang2
pwang2 / .Rprofile
Last active May 13, 2020 16:04
.Rprofile
library(colorout)
library(lintr)
library(styler)
grDevices::X11.options(width = 9.5, height = 8, ypos = 1000, xpos = 2800, pointsize = 10)
sysname <- Sys.info()[["sysname"]]
if (interactive() && sysname == "Linux" && Sys.getenv("DISPLAY") == "") {
if (Sys.getenv("TMUX") != "") {
set -xe
PID="$(lsof -ti:5901 | paste -sd' ' | awk '{print $0}')"
if [ ! -z "$PID" ]; then
echo "$PID"
kill -9 $PID
fi
ssh -fN -p 2930 -L 5901:localhost:5901 pwang2@65.52.0.118
/usr/bin/xtigervncviewer -SecurityTypes None :1
[Desktop Entry]
Exec=bash -c "PID=$(lsof -ti:5901) && [ ! -z $PID ] && kill -9 $PID; ssh -fN -p 2930 -L 5901:localhost:5901 pwang2@65.52.0.118 && /usr/bin/xtigervncviewer -SecurityTypes None :1"
Name=wx
GenericName=Wechat on VNC
Icon=terminal
Terminal=false
Type=Application
Categories=Utilities;Application;