Skip to content

Instantly share code, notes, and snippets.

View Versatilus's full-sized avatar

Eric Paulson Versatilus

  • Roseburg, Oregon, USA
View GitHub Profile
@Versatilus
Versatilus / TransparentSelectors.cs
Created September 13, 2020 21:41 — forked from ronyx69/TransparentSelectors.cs
Source code of the transparent selectors mod.
using ColossalFramework.IO;
using ColossalFramework.UI;
using ICities;
using System;
using System.IO;
using System.Reflection;
using System.Xml.Serialization;
using UnityEngine;
namespace TransparentSelectors
@Versatilus
Versatilus / ReplaceLaneProps.cs
Created September 13, 2020 21:13 — forked from ronyx69/ReplaceLaneProps.cs
Replace lane props on networks in the asset editor.
Action<string, string> ReplaceProp = (search, replace) =>
{
var replacementProp = PrefabCollection<PropInfo>.FindLoaded(replace);
for (uint i = 0; i < PrefabCollection<NetInfo>.LoadedCount(); i++)
{
var prefab = PrefabCollection<NetInfo>.GetLoaded(i);
if (prefab == null) continue;
if(prefab.m_lanes != null) foreach (var Lane in prefab.m_lanes)
{
@Versatilus
Versatilus / Network_SegmentNode_Reorder.cs
Created September 13, 2020 21:13 — forked from ronyx69/Network_SegmentNode_Reorder.cs
Network segment and node reorder scripts. Refreshes UI automatically.
// Network segment and node reorder scripts. Refreshes UI automatically.
// SEGMENTS
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as NetInfo;
# -*- coding: utf-8 -*-
# Author: Eric Lewis Paulson (Versatilus)
# License: Public Domain
# except`url_fix` adapted from werkzeug
# see https://github.com/pallets/werkzeug/blob/master/LICENSE.rst
# Version: 20200109-001525 (-8 UTC)
r"""
A simple set of voice commands for mangling text with the clipboard.
from __future__ import print_function, unicode_literals
from ctypes import windll
from dragonfly import (ActionBase, Choice, Grammar, IntegerRef, Key,
MappingRule, Mouse, Pause, Repeat)
from dragonfly.actions.keyboard import Keyboard, KeySymbols
KEYBOARD = Keyboard()
@Versatilus
Versatilus / _chrome_personal.py
Created May 5, 2019 12:09
Personal speech recognition (Dragonfly) command set for Google Chrome
#!python
# -*- coding: utf-8 -*-
"""
This is relevant as of 20190505. I have no plans of updating this gist. Some of
this is written in a style I wouldn't necessarily use now, but I'll let you
guess what that is.
I'm not going to bet that any of this works. I haven't updated it in months, if
not years. I know that some of the Facebook commands don't work. I use most of
@Versatilus
Versatilus / Dragonfly_Basics.md
Created December 22, 2018 17:34
Dragonfly Basics

The most common type of grammar is a MappingRule (or MergeRule in Caster). It is built from three variables:

  • a mapping dictionary
  • an extras list
  • and an optional defaults dictionary.

A mapping maps a specially formatted spoken phrase to some Action class, usually some combination of Key, Text, or Function.

A spoken phrase is usually some combination of the following:

  • literal spoken text
  • alternatives separated by | and grouped by ()
[
{
"name": "Pink",
"hex": "ffc0cb",
"rgb": "255,192,203"
},
{
"name": "LightPink",
"hex": "ffb6c1",
"rgb": "255,182,193"
@Versatilus
Versatilus / text_patch.py
Last active May 20, 2018 18:44
Adaptation of Dragonfly's Text action to use Unicode keyboard emulation for use with Caster.
# -*- coding: utf-8 -*-
#
# This file uses code from and is intended to replace the Text Action class
# distributed as part of Dragonfly.
# (c) Copyright 2018 by Eric Lewis Paulson
# with portions
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
@Versatilus
Versatilus / gist:4dd0fd77d8140dfea24816b611c38fc9
Created April 14, 2018 23:30 — forked from anvaka/gist:3815296
JavaScript Function Serialization
function functionReplacer(key, value) {
if (typeof(value) === 'function') {
return value.toString();
}
return value;
}
function functionReviver(key, value) {
if (key === "") return value;