Skip to content

Instantly share code, notes, and snippets.

@richardbuckle
richardbuckle / FC events.json
Last active April 9, 2020 22:19
Fleet carrier events
{
"timestamp": "2020-04-07T21:00:48Z",
"event": "Fileheader",
"part": 1,
"language": "English\\UK",
"gameversion": "Fleet Carriers Update Beta 1 Patch 1",
"build": "r228222/r0 "
}
{

About Cottle templates in function arguments

I think I've got to the bottom of why EDDI is highlighting e.g. line 90 of the "Bodies to map" script in v3.5.2.

No built-in Cottle functions reparse their arguments

There is no equivalent of eval() in Cottle as far as I can see. That may well have been a conscious decision: I do not know. Anyhow, all arguments passed to functions are just inert strings and are not subject to further parsing by Cottle.

Proof: if I feed this to the demo app in the Cottle project:

{set mappedBodies to 1}
@richardbuckle
richardbuckle / journal.log
Last active October 11, 2019 19:41
Journal for Drought system
{ "timestamp":"2019-10-11T19:29:11Z", "event":"FSDJump", "StarSystem":"Quator", "SystemAddress":10494151027, "StarPos":[71.62500,47.75000,64.81250], "SystemAllegiance":"Federation", "SystemEconomy":"$economy_Colony;", "SystemEconomy_Localised":"Colony", "SystemSecondEconomy":"$economy_Extraction;", "SystemSecondEconomy_Localised":"Extraction", "SystemGovernment":"$government_Corporate;", "SystemGovernment_Localised":"Corporate", "SystemSecurity":"$SYSTEM_SECURITY_low;", "SystemSecurity_Localised":"Low Security", "Population":1000, "Body":"Quator", "BodyID":0, "BodyType":"Star", "JumpDist":2.607, "FuelUsed":0.025747, "FuelLevel":31.974253, "Factions":[ { "Name":"Quator Ring", "FactionState":"Drought", "Government":"Anarchy", "Influence":0.009970, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand3;", "Happiness_Localised":"Discontented", "MyReputation":0.000000, "ActiveStates":[ { "State":"Drought" } ] }, { "Name":"Pilots' Federation Local Branch", "FactionState":"None", "Government":"Democracy",
@richardbuckle
richardbuckle / mutable-colls-bad.md
Last active June 12, 2019 21:18
Why public mutable collection properties aren't thread-safe

Intro

I've been asked to expand on why C#/.NET classes having public mutable collection properties are incompatible with thread-safety, and why immutable collections or the specialised concurrent collections might be better choices.

All code below can be run in Visual Studio's "C# Interactive" window.

The problem

The problem is this: it's fundamentally not possible to make a class thread-safe which exposes properties that are mutable collections, even if the setter is private.

##Intro

I've been asked to expand on why C#/.NET classes having public mutable collection properties are incompatible with thread-safety, and why immutable collections or the specialised concurrent collections might be better choices.

All code below can be run in Visual Studio's "C# Interactive" window.

The problem

The problem is this: it's fundamentally not possible to make a class thread-safe which exposes properties that are mutable collections, even if the setter is private.

@richardbuckle
richardbuckle / Journal.log
Created January 27, 2019 11:12
Jump to i Bootis
{ "timestamp":"2019-01-26T22:16:40Z", "event":"StartJump", "JumpType":"Hyperspace", "StarSystem":"i Bootis", "SystemAddress":1281787693419, "StarClass":"G" }
{ "timestamp":"2019-01-26T22:16:59Z", "event":"ReceiveText", "From":"", "Message":"$COMMS_entered:#name=i Bootis;", "Message_Localised":"Entered Channel: i Bootis", "Channel":"npc" }
{ "timestamp":"2019-01-26T22:16:59Z", "event":"FSDJump", "StarSystem":"i Bootis", "SystemAddress":1281787693419, "StarPos":[-22.37500,34.84375,4.00000], "SystemAllegiance":"Federation", "SystemEconomy":"$economy_Agri;", "SystemEconomy_Localised":"Agriculture", "SystemSecondEconomy":"$economy_None;", "SystemSecondEconomy_Localised":"None", "SystemGovernment":"$government_Democracy;", "SystemGovernment_Localised":"Democracy", "SystemSecurity":"$SYSTEM_SECURITY_medium;", "SystemSecurity_Localised":"Medium Security", "Population":2299999, "JumpDist":5.475, "FuelUsed":0.342235, "FuelLevel":1.657765, "Factions":[ { "Name":"i Bootis Democrats", "FactionState":"Investment", "Governm
@richardbuckle
richardbuckle / gist:ac34863f350fa7581774549b273c15d4
Created September 16, 2018 21:59
Mission check galaxy VB version
{_ Mission report }
{_ Check what systems you have missions in }
{_ Setup allmissions function }
{set allmissions(system) to:
{set here to find(systems, system)}
{if here > -1:
{set number to systems_count[here] + 1}
{set systems_count to union(systems_count, [here:number])}
@richardbuckle
richardbuckle / French journal.log
Created April 17, 2018 19:31
French language Elite Dangerous journal
{ "timestamp":"2018-04-17T19:13:12Z", "event":"Fileheader", "part":1, "language":"French\\FR", "gameversion":"3.0.5.402 EDH", "build":"r168330/r0 " }
{ "timestamp":"2018-04-17T19:13:12Z", "event":"Music", "MusicTrack":"NoTrack" }
{ "timestamp":"2018-04-17T19:13:12Z", "event":"Music", "MusicTrack":"MainMenu" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"Doug Heisenberch" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"Myself_st" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"ST4R F0X" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"Spike1986" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"Freak97" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"NSR2" }
{ "timestamp":"2018-04-17T19:13:45Z", "event":"Friends", "Status":"Online", "Name":"Valcor_" }
@richardbuckle
richardbuckle / make-qa-log.py
Created August 16, 2014 07:35
Format your Git change log into markdown for nightly builds
#! /usr/bin/env python
'''
Format the Git log between current and master into the markdown required for the HockeyApp nightly builds.
'''
import os
import re
ticketRegex = re.compile(r'#(\d+)')
@richardbuckle
richardbuckle / gist:2a72cf293ec9dd7b7e01
Last active August 29, 2015 14:05
Let's break Swift Integer addition
// written with Swift as of Xcode 6 beta 5
import Swift
let a = 2
let b = 5
let c = a + b // returns 42 not 7 even though coder is unaware of the override below, which could even be buried in a malicious import
// extremely evil override
public func + (x: Int, y: Int) -> Int {