Skip to content

Instantly share code, notes, and snippets.

View migrate.py
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 = ""
View dracula.zsh-theme
# -*- 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
View perfect-scroll.js
let PerfectScrollbar
const isTouchDevice = "ontouchstart" in document.documentElement
if (!isTouchDevice) {
PerfectScrollbar = require("vue2-perfect-scrollbar")
require("vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css")
} else {
PerfectScrollbar = {
install(Vue) {
Vue.component("PerfectScrollbar", {
View axiosCacheAdapter.js
import localForage from "localforage"
import buildURL from "axios/lib/helpers/buildURL"
const forageCache = {
get: async (key) => {
const data = await localForage.getItem(key)
if (!data) return null
const { expire, value } = data
if (expire < Date.now()) {
@pwang2
pwang2 / init.lua
Last active Nov 23, 2020
hammerspoon init file
View init.lua
hs.loadSpoon("Lunette")
spoon.Lunette:bindHotkeys()
hs.alert.show("Config Reloaded")
hs.loadSpoon("ReloadConfiguration")
spoon.ReloadConfiguration:start()
function changeVolume(diff)
return function()
local current = hs.audiodevice.defaultOutputDevice():volume()
View .alacritty.yml
# https://github.com/alacritty/alacritty/blob/master/alacritty.yml
background_opacity: 1
live_config_reload: true
shell:
program: /bin/zsh
args:
- --login
@pwang2
pwang2 / preexec-display
Last active May 13, 2020
preexec to sync DISPLAY env
View preexec-display
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 / .tern-config
Last active May 13, 2020
.tern-config
View .tern-config
{
"ecmaVersion": 8,
"libs": [
"browser"
],
"loadEagerly": [ ],
"dontLoad": [
"node_modules/**"
],
"plugins": {
@pwang2
pwang2 / .Rprofile
Last active May 13, 2020
.Rprofile
View .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") != "") {
View startvnc.sh
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