Skip to content

Instantly share code, notes, and snippets.

View AndrewLipscomb's full-sized avatar

Andrew Lipscomb AndrewLipscomb

View GitHub Profile
@AndrewLipscomb
AndrewLipscomb / main_a.cpp
Created June 22, 2020 08:54
3rd Attempt at C++ q
#include "./templates_a.h"
int main()
{
LocalTypeA bbb;
bbb.internal_ = new LocalTypeB();
do_foo<LocalTypeA>(LocalTypeA());
return 0;
}
@AndrewLipscomb
AndrewLipscomb / impl_b.cpp
Created June 18, 2020 21:38
Yet Another attempt at describing the SO question
#include "./templates_b.h"
#if defined(B_WITH_TAG)
template <>
auto do_foo(Tag<LocalTypeB>, LocalTypeB data)
{
return do_foo<bool>(data.the_val);
}
@AndrewLipscomb
AndrewLipscomb / main_a.cpp
Created June 18, 2020 12:53
Better C++ SE question
#include "./templates_a.h"
// Compile `gcc main_a.cpp`
int main()
{
do_foo<LocalTypeA>(LocalTypeA());
return 0;
}
#include <string>
#include <type_traits>
template<typename T, typename R>
R do_foo(T bb)
{
static_assert(std::is_same<T, void>::value && false, "No use here");
}
template<typename T, typename R>
Sending build context to Docker daemon 152.5MB
Step 1/15 : FROM ubuntu:18.04 as build-base
---> c3c304cb4f22
Step 2/15 : RUN apt-get update && apt-get install -y devscripts equivs
---> Running in d2b4cd630d2f
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [933 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
@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
@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

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 / 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
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