Skip to content

Instantly share code, notes, and snippets.

View OdatNurd's full-sized avatar

Terence Martin OdatNurd

View GitHub Profile
@OdatNurd
OdatNurd / project_specific_files.py
Last active January 2, 2024 07:19
Sublime Text plugin for making opened files open in the window for the project
import sublime
import sublime_plugin
from os.path import isabs, isfile, normpath, realpath, dirname, join
# Related reading:
# https://forum.sublimetext.com/t/forbid-st-from-opening-non-project-files-in-the-projects-window/68989
# The name of the window specific setting that determines if the functionality
# of this plugin is enabled or not, and an indication of whether the plugin
@OdatNurd
OdatNurd / Adaptive.sublime-theme
Last active December 9, 2023 05:57
Patched Adaptive.sublime-theme for modifying the color of files in the sidebar based on their git status
[
// VCS badges
{
"class": "vcs_status_badge",
"parents": [{"class": "file_system_entry", "attributes": ["untracked"]}],
"layer0.texture": "Theme - Default/common/status_untracked.png",
"layer0.tint": "color(var(--yellowish) blend(rgb(255, 255, 255) 60%))",
"layer0.opacity": 1.0,
"content_margin": 6
},
@OdatNurd
OdatNurd / Mariana.sublime-color-scheme
Last active September 14, 2023 20:58
OdatNurd's customizations on the Mariana color scheme
{
"globals":
{
"background": "color(var(blue3) l(- 3%))",
"line_diff_added": "var(green)",
"line_diff_modified": "var(blue)",
"line_diff_deleted": "var(red)",
"line_diff_width": "5",
"brackets_options": "glow",
"bracket_contents_options": "glow",
@OdatNurd
OdatNurd / markdown_password_copy.py
Created August 26, 2023 06:54
Simple plugin that lets you easily copy temporary passwords out of markdown files
import sublime
import sublime_plugin
from urllib.parse import quote, unquote
class SetUpButtonsCommand(sublime_plugin.TextCommand):
"""
When executed, this command checks the current file for all items that
match the regular expression and adds a phantom that alows for copying
@OdatNurd
OdatNurd / log_file_tail.py
Created August 22, 2023 04:54
Sublime Text 4 plugin that will cause reloaded log files to jump to the bottom of the file on new content
import sublime
import sublime_plugin
from fnmatch import fnmatch
# Related Reading:
# https://forum.sublimetext.com/t/auto-scroll-to-bottom-tail-log-files/69156
#
# For any opened file that matches one of the globs set out below, this will
# cause the view of the file to jump to the bottom whenever the file reloads
@OdatNurd
OdatNurd / Default (PLATFORM).sublime-keymap
Created March 4, 2021 23:16
Closing a Terminus view and pane at the same time
[
// If you use the Chain of Command package, use this binding to chain
// the two required commands together.
{ "keys": ["ctrl+shift+h"], "command": "chain",
"args": {
"commands": [
["terminus_close"],
["destroy_pane", {"direction": "self"}]
]
},
@OdatNurd
OdatNurd / Context.sublime-menu
Last active March 17, 2023 06:03
Example plugin for encrypting and decrypting files from Sublime
[
{ "caption": "-", "id": "end" },
{ "command": "encrypt" },
]
@OdatNurd
OdatNurd / .python-version
Last active March 12, 2023 17:04
Browse all Sublime Text commands provided by plugins
3.8
@OdatNurd
OdatNurd / text_highlight.py
Last active January 17, 2023 19:13
Simple Text Highlight Plugin
import sublime
import sublime_plugin
import functools
import re
# The key the key that we use to add regions for the word currently under the
# cursor (when that is turned on), the style of the regions added, and the
# scope that represents the color to use when words are highlighted.
CURRENT_WORD_KEY='_sel_word'
@OdatNurd
OdatNurd / eventsub_sample.js
Created January 4, 2022 05:39
Quick example of using Twurple EventSub
const { ClientCredentialsAuthProvider } = require('@twurple/auth');
const { ApiClient } = require('@twurple/api');
const { NgrokAdapter } = require('@twurple/eventsub-ngrok');
const { EventSubListener } = require('@twurple/eventsub');
async function testEventSub() {
// Create an auth provider tied to our application's client ID and secret.
const authProvider = new ClientCredentialsAuthProvider(
process.env.TWITCHBOT_CLIENT_ID,