Skip to content

Instantly share code, notes, and snippets.

@wongjustin99
wongjustin99 / 591_tampermonkey.js
Created March 15, 2022 08:40
591_picture_shortcuts_tampermonkey_chrome
// ==UserScript==
// @name 591 click next and previous with arrow-keyss
// @version 1
// @grant none
// @match https://*.591.com.tw/*
// @run-at document-start
// ==/UserScript==
(function() {
@wongjustin99
wongjustin99 / 591_picture_shortcuts
Last active December 6, 2022 14:48
Shortcuts to browse 591 by keyboard
// ==UserScript==
// @name 591 click next and previous with arrow-keyss
// @version 1
// @grant none
// @match https://*.591.com.tw/*
// @run-at document-start
// ==/UserScript==
KeyEvent = (typeof KeyEvent === "object") ? KeyEvent : [];
@wongjustin99
wongjustin99 / .tmux.conf
Created May 11, 2021 16:13
tmux statusbar green fix after upgrade to 3.2
# old config line
# set -g status-bg default
# replace with the following:
set -g status-style bg=default
@wongjustin99
wongjustin99 / v2ray.sh
Created November 20, 2019 19:07
v2ray
#!/bin/bash
red='\e[91m'
green='\e[92m'
yellow='\e[93m'
magenta='\e[95m'
cyan='\e[96m'
none='\e[0m'
_red() { echo -e ${red}$*${none}; }
_green() { echo -e ${green}$*${none}; }
@wongjustin99
wongjustin99 / swiftui_url_link.swift
Created October 29, 2019 08:29
SwiftUI open URL link
@wongjustin99
wongjustin99 / plaintext_python3_http_server.py
Created September 9, 2019 03:07
python_http_server_with_plaintext_contenttype
#!/usr/bin/env python3
# Mostly sourced from https://stackoverflow.com/questions/37585147/unable-to-view-files-in-a-browser-with-python-http-server
from http.server import SimpleHTTPRequestHandler, test
import argparse
class InlineHandler(SimpleHTTPRequestHandler):
@wongjustin99
wongjustin99 / dark_mode
Created September 8, 2019 12:31
Dark mode detection in Swift
if traitCollection.userInterfaceStyle == .light {
print(“Light”)
} else {
print(“Dark”)
}
@wongjustin99
wongjustin99 / runAppleScript.swift
Created August 3, 2019 05:16
Run AppleScript from URL in swift
// need to remove extenion in XCode 10.1, or else I get weird encoding errors that corrupt the script file even when using outside of XCode
let myAppleScript = Bundle.main.url(forResource: "say_hello", withExtension: nil)!
// unnecessary catch statements/need some cleanup
func runAppleScriptFromUrl(scriptUrl: URL) {
do {
var errorScriptLoad: NSDictionary?
if let scriptObject = NSAppleScript(contentsOf: scriptUrl, error: &errorScriptLoad) {
var error: NSDictionary?
if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}"/>
<meta name="robots" content="noodp"/>
<link rel="canonical" href="{{ .Permalink }}" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}" />
<meta name="twitter:title" content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" />
<meta name="twitter:site" content="{{ .Site.Params.twitter }}" />
<meta name="twitter:creator" content="{{ .Site.Params.twitter }}" />
brew install weechat --with-python --with-perl
pip3 install --upgrade pip setuptools
pip3 install websocket-client
mkdir -p ~/.weechat/python/autoload
wget https://raw.githubusercontent.com/wee-slack/wee-slack/master/wee_slack.py
cp wee_slack.py ~/.weechat/python/autoload

https://api.slack.com/custom-integrations/legacy-tokens