Skip to content

Instantly share code, notes, and snippets.

View AndrewLipscomb's full-sized avatar

Andrew Lipscomb AndrewLipscomb

View GitHub Profile
@AndrewLipscomb
AndrewLipscomb / editcontrol.js
Created December 24, 2016 01:55
editcontrol.js with bug triggers
import React, { Component } from 'react';
import { Map, TileLayer, Circle, FeatureGroup } from 'react-leaflet';
import { EditControl } from '../src';
let polyline;
const subs = [ 'a', 'b', 'c', 'd' ];
export default class EditControlExample extends Component {
constructor(props) {
super(props);
@AndrewLipscomb
AndrewLipscomb / httpwindow.cpp
Created September 27, 2017 03:56
Modified Qt HTTP Example
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
@AndrewLipscomb
AndrewLipscomb / Cmd.DockAgent.xml.decoded
Last active February 11, 2018 09:31
Dock Agent Decoded
* This command frequently resets itself (gosub Reboot:) to avoid the DA getting stuck.
set script command: [COMMAND_DOCK_AGENT]
skip if [HOMEBASE]-> exists
return null
$scriptName = get script name
= [THIS]-> call script 'Lib.Gen.SetEIAutoStartParameters' : Args=null ScriptName=$scriptName
[THIS]-> connect ship command/signal [SIGNAL_ATTACKED] to script 'Sig.Attacked.DockAgent' with prio 100
@AndrewLipscomb
AndrewLipscomb / Cmd.DockAgent.xml
Created February 11, 2018 09:35
Dock Agent Encoded
<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet href="x2script.xsl" type="text/xsl"?>
<!-- Generated using X-Studio -->
<script>
<name>Cmd.DockAgent</name>
<version>308</version>
<engineversion>50</engineversion>
<description>Cmd: Manages a Sanctuary or a Dock by acquiring or distributing wares.</description>
<arguments />
<sourcetext>
const {AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip} = Recharts;
const data = [
{wangs: 1.0, uv: 3},
{wangs: 1.9999999999999, uv: 3},
{wangs: 2.0, uv: 4},
{wangs: 2.99999, uv: 4},
{wangs: 3.0, uv: 2},
{wangs: 3.99999, uv: 2},
{wangs: 4.0, uv: 5},
{wangs: 5.0, uv: 6},
Wed 2019-04-10 10:38:38.133: job_maintainer_node: Client sent list for:
Wed 2019-04-10 10:38:38.133: job_maintainer_node: /home/swarmbot/swarmbotCommon/PaddockDefinitions/BendeeWithRoads/GrassDownTheRoad/bendee_1_grass_down_the_road_1_of_1.txt
Wed 2019-04-10 10:38:38.133: job_maintainer_node: /home/swarmbot/swarmbotCommon/PaddockDefinitions/BendeeWithRoads/HousePaddock/bendee_1_house_paddock_1_of_4.txt
Wed 2019-04-10 10:38:38.133: job_maintainer_node: While continuing /home/swarmbot/swarmbotCommon/PaddockDefinitions/BendeeWithRoads/Airstrip/demo_goals_airstrip_1_of_3.txt
Wed 2019-04-10 10:38:39.227: events_node: Setting event DebugEvent:1 -> Time delay exceeded
Wed 2019-04-10 10:38:39.227: job_maintainer_node: --- Saved an image of the generated path outside the polygon to /home/swarmbot/path_not_in_poly.svg for path of 7 points ---
Wed 2019-04-10 10:38:39.227: job_maintainer_node: Exception in File: /home/swarmbot/swarmbot4/swarmbot_ws/src/job_maintainer/src/travel_jo
@AndrewLipscomb
AndrewLipscomb / main.swift
Created April 11, 2019 04:27
CoreLocation stack trace
2019-04-11 14:21:42.525 BugTest[25240:2608649] +[NSValue valueWithMKCoordinate:]: unrecognized selector sent to class 0x7fff872763a8
2019-04-11 14:21:42.526 BugTest[25240:2608649] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSValue valueWithMKCoordinate:]: unrecognized selector sent to class 0x7fff872763a8'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2eeb0cf9 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff59a44a17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2ef2aa56 __CFExceptionProem + 0
3 CoreFoundation 0x00007fff2ee530ef ___forwarding___ + 1485
4 CoreFoundation 0x00007fff2ee52a98 _CF_forwarding_prep_0 + 120
5 libswiftCoreLocation.dylib 0x00007fff5ad61664 globalinit_33_25AD2332B1DC67E23B54508C4A7DAD45_func0 + 132
Upon installation, make sure you have
`dhclient iwd iwctl htop sudo`
for networking, perf and basic sandwich needs
Reboot and once back in normally, fix the keyboard to Norman
```
```
@AndrewLipscomb
AndrewLipscomb / README.md
Created March 2, 2020 08:59
Setting up Xenial nspawn containers

Getting a minimal Ubuntu 16.04 Xenial nspawn container running

Making this work requires a bit of extra effort to get it to a nice point.

Essentially we are aiming for a container that:

  • Can be worked properly using machinectl
  • Can be logged into without having to type passwords (obviously don't do this if you expose it publically)

This guide assumes you run your networking with systemd-networkd - if you don't, you will need to sort out container networking yourself. Check you aren't using network-manager with

@AndrewLipscomb
AndrewLipscomb / README.md
Created March 24, 2020 11:06
How to set up static nspawn IP address networking without a bridge

How to set up static nspawn IP address networking without a bridge

Note - this article assumes you have reasonable familiarity with systemd, networkd and nspawn/machinectl

What is this guide for

There seem to be a lot of references on the internet for nspawn networking with a bridge - but not on simply using the stock veth networking with static addresses. The default behaviour of nspawn (as of 24/03/20 and systemd:245 on Arch) is to:

  • Make a virtual ethernet port on the host (defined by /lib/systemd/network/80-container-ve.network)
  • Make a virtual ethernet port in the container (defined by /lib/systemd/network/80-container-host0.network)
  • Based on those configurations, serve the host port a random IP from the local network ranges with a 28 bit subnet, and a DHCP server for the host port serves a random IP in the subnet to the container