Skip to content

Instantly share code, notes, and snippets.

View milesrout's full-sized avatar

Miles Rout milesrout

View GitHub Profile
@milesrout
milesrout / list-focused-fftabs.py
Last active November 29, 2019 09:28 — forked from tmonjalo/list-fftabs.py
List currently focused Firefox tabs
#! /usr/bin/env python3
"""
List all Firefox tabs with title and URL
Supported input: json or jsonlz4 recovery files
Default output: title (URL)
Output format can be specified as argument
"""
@milesrout
milesrout / tclass.py
Created October 9, 2018 11:56 — forked from louisswarren/tclass.py
Extension of inheriting from namedtuple
def tclass(*argnames, then_do=None):
if len(argnames) == 1 and isinstance(argnames[0], dict):
argnames = argnames[0]
def decorator(cls):
def inner_init(self, *args, **kwargs):
for argname, arg in zip(argnames, args):
self.__setattr__(argname, arg)
for argname in list(argnames)[len(args):]:
self.__setattr__(argname, argnames[argname])
@milesrout
milesrout / DCPU-16N.txt
Created August 25, 2018 12:49 — forked from Meisaka/DCPU-16N.txt
DCPU redesigns
DCPU-16N Specification
Copyrights 1985 Mojang, Meisaka Yukara
Version 0.14 influenced by DCPU-16 (1.7)
=================================== SUMMARY ====================================
* 16 bit CISC CPU design
* DCPU-16 compatibility functions
* 8/16 bit switchable memory word size (1 octet per address or 2 octets per address)
@milesrout
milesrout / xterm-256color-italic.terminfo
Created July 18, 2018 23:17 — forked from sos4nt/xterm-256color-italic.terminfo
A xterm-256color based TERMINFO that adds the escape sequences for italic
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
@milesrout
milesrout / DCPU-16Spec.txt
Created April 11, 2018 04:45 — forked from metaphox/DCPU-16Spec.txt
DCPU-16 Specification
DCPU-16 Specification
Copyright 1985 Mojang
Version 1.7
=== SUMMARY ====================================================================
* 16 bit words
* 0x10000 words of ram
@milesrout
milesrout / gist:be471f43cee5c4a52ed9492b0f606115
Created October 27, 2017 11:49 — forked from croxis/gist:6436553c3542ec692c1d
Rendering procedural planets.
Based on feedback from ChemicalR I'm cross posting all the things I've bookmarked in reguards to planet rendering here in the code forums.
[url=http://www.gamasutra.com/view/feature/3098/a_realtime_procedural_universe_.php]Sean O'Neil[/url]'s 4 2001 part series is considered a foundation for realistic large scale (planets on up) rendering. Most of these methods are now obsolete and replaced with faster methods and gpu shaders. His [url=http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html]atmospheric scattering[/url]method is still used often due to its relative simplicity, but it only produces earth atmospheres.
[url=http://acko.net/blog/making-worlds-1-of-spheres-and-cubes/]Steven Wittens[/url] 2009 multipart series is frequently linked to as I've searched for best practices in creating planets using modern methods. It is based on a cube with mesh texture and normalizes the vertex points into a sphere. The advantage to this method is that conventional terrain LOD methods, often used in first
@milesrout
milesrout / gist:0f3e210d89f799f004027900b0ef8c01
Created October 27, 2017 11:48 — forked from croxis/gist:f08d1ce071072b8efbc0
Trillek Single Solar System Arguments
In irc there was talk about FTL and the assorted gameplay issues with each method. Then I started thinking about other design and story issues trillek is having. Then I started thinking about my space game I haven't touched in a while.
A few years ago I saw a video similar to this one http://vimeo.com/40234826 and I was really struck by saturn's moons. Saturn has over 70 moons. That is a lot of surface area to explore and with assorted orbits around each moon, and saturn itself, that is a lot of gamespace. I also saw this picture http://misc.oranse.net/misc/wallpaper/earth.jpg taken from low Earth orbit and how amazing our planet looked from low orbit. I started designing a game with the setting of just our solar system that takes place during humanity's expansion into our solar system.
What if we used that setting, or a similar one, instead? What if trillek takes place in one solar system?
Using our solar system as a model: There are 4 terrestial planets. 4 gas giants. At least 4 dwarf planets and a numbe
@milesrout
milesrout / foreach.py
Created March 15, 2017 01:31 — forked from louisswarren/foreach.py
Javascript's foreach in python
accumulate = lambda t: lambda f: lambda *a, **k: t(f(*a, **k))
@accumulate(list)
def foreach(iterable, func):
for i, x in enumerate(iterable):
yield func(x, i)
mylist = list(chr(n) for n in range(65, 75))
foreach(mylist, lambda x, i: print('{} => {}'.format(i, x)))
@milesrout
milesrout / youtube-terminal.py
Last active March 8, 2017 02:24 — forked from anonymous/youtube-terminal.py
Play audio from a youtube search in the terminal
#!/usr/bin/env python3
from os import system
from sys import argv
# Example:
# youtube-terminal.py foo bar baz
# calls youtube-dl 'ytsearch:foo bar baz' --max-downloads 1 -o - | cvlc - --no-video
call = 'youtube-dl "ytsearch:{}" --max-downloads 1 -o - | cvlc - --no-video'.format
system(call(' '.join(argv[1:])))
@milesrout
milesrout / humour.py
Created January 23, 2017 08:04 — forked from louisswarren/humour.py
A turing machine can't solve the halting problem, but it can solve the hilarity problem, right gang?
prepositions = """
aboard, about, above, across, after, against, along, amid, among, anti,
around, as, at, before, behind, below, beneath, beside, besides, between,
beyond, but, by, concerning, considering, despite, down, during, except,
excepting, excluding, following, for, from, in, inside, into, like, minus,
near, of, off, on, onto, opposite, outside, over, past, per, plus,
regarding, round, save, since, than, through, to, toward, towards, under,
underneath, unlike, until, up, upon, versus, via, with, within, without
""".split(', ')