Skip to content

Instantly share code, notes, and snippets.

View tildedave's full-sized avatar
🌮
Hungry

Dave King tildedave

🌮
Hungry
View GitHub Profile
CMD_SHOWGRID [#270R]: $^\+showgrid(/lr|/sm)?$:@switch [u(fn_grid_is_active)][and(hasattr(v(ship_obj),coords),hasattr(v(ship_obj),orientation))]=0*,{th syspemit(%#,The grid is not currently active.)},10,{th syspemit(%#,[ansi(hw,u(v(ship_obj)/get_name))] is not on the grid.)},{@pemit %#=[ulocal(fn_generate_[switch(%1,/lr,long,/sm,small,short)]_range_grid)]}
FN_GENERATE_SHORT_RANGE_GRID [#270]: [setq(0,ulocal(fn_generate_grid_info))][setq(1,ulocal(fn_get_extended_info,ulocal(fn_fill_and_rotate_larger_space_objects,ulocal(fn_generate_grid_legend,filter(fn_detects_object,ulocal(fn_adjust_coords_to_absolute_val,map(fn_adjust_relative_coords,%q0),short)))),rest(v(short_range_params))))][ulocal(fn_display_grid_and_legend,ulocal(fn_fill_short_range_grid,%q1),%q1)]
FN_GENERATE_LONG_RANGE_GRID [#270]: [setq(0,ulocal(fn_generate_grid_info))][setq(1,ulocal(fn_get_extended_info,ulocal(fn_fill_and_rotate_larger_space_objects,ulocal(fn_generate_grid_legend,filter(fn_detects_object,ulocal(fn_adjust_coords_to_absolute_val,ma
@tildedave
tildedave / gist:1525601
Created December 28, 2011 00:56
intersteller transport function from one of my old MUSHes
PARENT: Intergalactic Transportation Node(#690TWn)
Type: THING Flags: WIZARD NO_COMMAND
An intergalactic transport node. See [ansi(hy,+help transports)] for information as to their use.
Owner: Pozzo(#270POWwerACMcJ) Zone: *NOTHING* Building Chips: 10
Parent: *NOTHING*
Powers:
Channels: SpaceMonitor
Warnings checked:
Created: Thu May 20 20:53:07 2004
Last Modification: Sun Mar 18 17:53:42 2007
@tildedave
tildedave / FN_CMD.DO_+TRANSPORT
Created December 28, 2011 01:04
do-+transport code, broken out to be readable
[syspemit(%#,
You take [setr(g,a transport from [ansi(hy,[name(loc(%!))])]
to [ansi(hy,[name(%qd)])]. The trip takes
[setq(h,u(fn_get_travel_time_between_systems,
u(zone(loc(%!))/fn_get_system),
u(zone(squish(%qd))/fn_get_system)))]
[iter(timestring(mul(%qh,60,60)),
if(and(f(strmatch(##,0*)),
f(strmatch(##,*m)),
@tildedave
tildedave / watch-out-for-class-variables.py
Created December 29, 2011 16:53
Don't initialize variables in the class, initialize them in the constructor
class Object(object):
l = []
def __init__(self):
pass
def add_one(self):
self.l.append(1)
@tildedave
tildedave / carceri-save-subroutines.bas
Created January 20, 2012 10:22
save/load functionality for one of my QBasic games (circa 1996?)
SAVE: INPUT "What is your name?", N$
IF N$ = "" THEN N$ = "the_elf"
SAV$ = N$ + ".cas"
OPEN SAV$ FOR OUTPUT AS #1
PRINT #1, RM
PRINT #1, Level
PRINT #1, Orb
PRINT #1, Hp
PRINT #1, MaxHp
PRINT #1, GatesOpened
@tildedave
tildedave / calculus.bas
Created January 20, 2012 10:31
polynomial derivatives/integrals in QBasic (written circa 1997 ?)
DECLARE SUB PolyDerv ()
DECLARE SUB PolyInt ()
CLS
PRINT "Calculus:": PRINT
PRINT "1. Evaluate derivative of a polynomial function"
PRINT "2. Evaluate integral of a polynomial function"
PRINT : INPUT ">", A: PRINT
IF A = 1 THEN PolyDerv
IF A = 2 THEN PolyInt
dave@isis:~/workspace/reach/reach$ howdoi show halting problem undecidable
In other words, is there an important difference between saying H = M and the following description from the proof? The H machine is called Universal Turing Machine (UTM) and is able to simulate any other Turing Machine, including itself. If M is an Universal Turing Machine like H, it is ok to say H = M, otherwise this would be weird. I thought the halting problem was the problem of deciding if a given machine will halt regardless of its output(accept/reject). If a solution exists for a halting problem, it has to be something that analyses source code like a compiler/decompiler/disassembler instead of actually running it. If it needed to run it, obviously it would never determine on a "no" answer. That is why the proof works based on contradiction and it is kind hard to understand.
Basically it assumes first that exists such a machine that answers "yes" or "no" to any given input. [Hypothesis] Let's call this machine Q.
Assuming Q is v
@tildedave
tildedave / gist:7371282
Last active December 20, 2018 20:16
Of course NaN is a number
user=> (/ 0.0 0.0)
NaN
user=> (type (/ 0.0 0.0))
java.lang.Double
@tildedave
tildedave / bootstrap-graphite.sh
Last active March 15, 2020 20:03
bootstrap graphite in the fastest way possible. do not use in production
#!/bin/bash -e
# Bootstrap graphite in the fastest way possible
# Run as root because Graphite hardcodes everything to /opt/graphite and it's too annoying to change this
# I did this on Ubuntu 12.04 LTS. For other operating systems you may need to install different apt packages.
apt-get update
apt-get install -y gcc python-virtualenv python-dev python-cairo
virtualenv graphite
source graphite/bin/activate
pip install whisper carbon graphite-web
Select an editor. To change later, run 'select-editor'.
1. /bin/ed
2. /bin/nano <---- easiest
3. /usr/bin/vim.basic
4. /usr/bin/vim.tiny