Skip to content

Instantly share code, notes, and snippets.

@FichteFoll
FichteFoll / bootstrap_logging.py
Last active August 29, 2015 14:16
Bootstraps the sublime.log_* functions to automatically toggle when called with no parameter (or `None`)
import sublime
from functools import partial
function_names = ('input', 'commands', 'result_regex', 'indexing')
# Cleanup
if hasattr(sublime, 'logging_unbootstrap'):
sublime.logging_unbootstrap()
# Assure this exists
@FichteFoll
FichteFoll / defer_action.py
Created February 24, 2015 00:44
TimeoutThread that defers actions until it was not poked again for a certain duration (timeout)
import sublime_plugin
import time
import threading
from functools import partial
from collections import namedtuple
class TimeoutThread(threading.Thread):
@FichteFoll
FichteFoll / _mana.py
Created November 21, 2014 20:00
Script for calculating mana (and mana regen stats per level) in League of Legends
#!/usr/bin/env python3
import math
import json
# In this entire file, all levels will be referred to from 1 to 18 (and not 0!)
def median(lst):
sortedLst = sorted(lst)
@FichteFoll
FichteFoll / FX_utils.lua
Created August 22, 2014 17:17
FX_utils.lua for Aegisub Automation karaokes
--[[
A template script used for Automation 4 karaoke FXes with Aegisub
You will want to call `register()` at the end of your script or whenever at least `script_name` is defined.
Functions to be defined:
* init(subs, meta, styles) [optional]
Called after all possibly existing previous fx lines have been deleted and the karaoke lines restored.
Do whatever you like in here. Won't be called if `init` is nil.
@FichteFoll
FichteFoll / delete_twitch_vods.js
Last active July 4, 2024 22:19
Highlight all your twitch VoDs, automatically. READ INSTRUCTIONS
/* For when you need to delete a range of videos or highlights.
*
* Use the first snippet once to show video indicies. Then use the second
* snippet and DON'T FORGET TO UPDATE THE RANGE INDICIES!!!!!!!!!!!
*
* The start index is inclusive, the end index is exclusive. Both may be
* negative numbers (going from behind). End index may be omitted.
*
* For other information, refer to `highlight_twitch_vods.js`'s comments.
*
@FichteFoll
FichteFoll / find_scopes.py
Last active May 8, 2016 02:22 — forked from sparr/scopecount
Download color schemes and count the occuring atomic scopes
#!/usr/bin/env python3
import requests
import plistlib
from collections import Counter
import posixpath
from urllib.parse import urlsplit
import sys
import os

Semantic Version Selectors

A semantic version selector (short: semsel) is a string that can match only onto specific semantic versions (semver). A semsel mainly consists of one or multiple comperators combined with inner logical ANDs and outer ORs.

A complete example could look like this:

>0.0.1-b.1337 <=0.0.2- || 0.0.3 +debug* || ~1.0 || 2.0.x +with* || 2.1.0- - 2.1.1- !2.1.1-b.9 || [3.1,3.3)
@FichteFoll
FichteFoll / ensure_newline_at_oef.py
Created June 26, 2014 17:02
Sublime Plugin: Always ensures a newline at eof
import sublime_plugin
# Override default command here that is restricted onto real views
# (and also does not modify selection)
class EnsureNewlineAtEofCommand(sublime_plugin.TextCommand):
def insert_nosel(self, view, edit, p, text):
"""Insert text without changing selection. Use with care.
"""
@FichteFoll
FichteFoll / output
Last active August 29, 2015 13:58
CSScheme Stylus Test File
@purpose "This is just an example file to show how you can use this tool"
// This at-rule is required
@name "Example SCSScheme"
// FLAGS
$punctuation = true
// The color palette (from http://serennu.com/colour/colourcalculator.php)
// Don't try these at home!
@FichteFoll
FichteFoll / tabs_in_titlebar_australis.css
Last active August 29, 2015 13:57
FireFox: Tabs in the title bar on Australis UI
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#main-window[chromemargin][sizemode="normal"]:not([inFullscreen])
#navigator-toolbox {
overflow: visible;
}
#main-window[chromemargin][sizemode="normal"]:not([inFullscreen])
#nav-bar {