Skip to content

Instantly share code, notes, and snippets.

View tconkling's full-sized avatar

Tim Conkling tconkling

View GitHub Profile
@tconkling
tconkling / maybe_echo.py
Created March 4, 2020 20:45
st.echo, but with a user-toggle for code visibility
import contextlib
import textwrap
import traceback
import streamlit as st
from streamlit import source_util
@contextlib.contextmanager
def maybe_echo():
@tconkling
tconkling / asmdefify.py
Last active December 1, 2019 20:01
Rearranges the source files in a Unity package folder for asmdef creation
#!/usr/bin/env python3
"""
Rearranges the source files in a Unity project folder for asmdef creation.
This script will create two directories within the target directory, "Runtime" and "Editor".
All files that live within an existing "Editor" folder will be moved to this new top-level
"Editor" folder, but with the rest of their folder hierarchy maintained. All other files
will be moved into the new top-level "Runtime" folder, also with their existing folder hierarchy
maintained.
@tconkling
tconkling / streamlit_serve_static_files.py
Last active December 21, 2022 14:21
Serve static files from your Streamlit app
"""
Edit `streamlit/lib/Server.py`, and add "static_path" to `TORNADO_SETTINGS`.
You'll also need to import the `os` package.
See https://www.tornadoweb.org/en/branch5.1/guide/running.html#static-files-and-aggressive-file-caching
for more details.
"""
import os
@tconkling
tconkling / DynamicTrigger.cs
Last active July 28, 2020 23:17
Utility for managing Unity trigger collision enter/exit events for destroyable triggers
using System.Collections.Generic;
using UnityEngine;
namespace TheHunt.Util {
/// <summary>
/// Extend this abstract base class to receive enter/exit events
/// from dynamic triggers.
/// </summary>
public abstract class DynamicTriggerListener : MonoBehaviour {
@tconkling
tconkling / StyleRun.as
Created August 27, 2017 18:42
Starling StyledText
//
// aciv
package aciv.text {
public class StyleRun {
public var length :uint;
public var color :uint;
}
@tconkling
tconkling / protobuf_table.py
Created October 30, 2013 00:12
ProtobufTable.py
#
# ProtobufTable
import re
import os
import logging
import pickle
from threading import RLock
import csv
class Grid(object):
'''Parses a csv file into a grid. Each cell in the grid is a list of strings, corresponding to
the string that was in the corresponding cell in the spreadsheet split by the given
'cell_item_separator', which defaults to a comma'''
def __init__(self, csv_text, width=0, height=0, cell_item_separator=','):
lines = list(csv.reader(csv_text.splitlines()))
self.height = height if height > 0 else len(lines)
@tconkling
tconkling / TaskSequencer
Created July 1, 2013 21:34
TaskSequencer using react
//
// aciv-core
package aciv.util {
import aspire.util.F;
import react.Future;
import react.Promise;
@tconkling
tconkling / gist:3260686
Created August 4, 2012 23:56
tconkling - bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
PATH=/usr/local/bin:~/bin:/export/assemblage/tools/bin:${PATH}
FIGNORE=".class:.svn:.cache"
export EDITOR="vi"
# don't put duplicate lines in the history. See bash(1) for more options
@tconkling
tconkling / gist:3260625
Created August 4, 2012 23:41
Sublime Text 2 settings
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Resesif.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Preferences (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.