Skip to content

Instantly share code, notes, and snippets.

View dannysauer's full-sized avatar

Danny Sauer dannysauer

View GitHub Profile
pipe = 1/2;
bearing_id = 3/8;
bearing_od = 7/8;
bearing_w = 9/32;
// max overlap is 0.50 == 50%
pipe_overlap_multiplier = 0.35;
pulley_od = 3;
pulley_lip = 1/16;
@dannysauer
dannysauer / math.c
Created April 14, 2019 23:11
Arithmatic parser
// process arbitrary 1+2-(3+(5-1))-2 style equations
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int parse(char[]);
int process(int, char, int);
struct State {
int total;
char operator;
@dannysauer
dannysauer / commands.sh
Created January 29, 2019 23:56
Leap15 KVM
sudo virt-install --name=leap15_dev --vcpus=8 --memory=$((1024*32)) --disk path=/var/lib/libvirt/local/leap15.qcow --os-variant=opensuse15.1 --import
@dannysauer
dannysauer / raspbian.sh
Created January 26, 2019 05:16
Set up netdata
cd /usr/local/src
sudo mkdir netdata && sudo chown --reference=$HOME netdata/
git clone https://github.com/netdata/netdata.git --depth=100
cd netdata
sauer@lightning:~$ sudo grep 2019-01-24 /var/log/zypp/history | awk -F\| '$2=="install"{print $3,$4,$5}' | sort
alsa-plugins 1.1.8-1.1 x86_64
apparmor-abstractions 2.13.2-3.1 noarch
apparmor-docs 2.13.2-3.1 noarch
apparmor-parser 2.13.2-3.1 x86_64
apparmor-parser-lang 2.13.2-3.1 noarch
apparmor-profiles 2.13.2-3.1 noarch
apparmor-utils 2.13.2-3.1 noarch
apparmor-utils-lang 2.13.2-3.1 noarch
bison 3.2.4-1.1 x86_64
@dannysauer
dannysauer / gist:b4f8ba1a021a7488d137c7fc14a7d20b
Last active August 3, 2018 14:52
Overriding network namespace

To override name resolution, create a mount namespace and bind mount a special resolv.conf over the top of the original. The IP address will be the first address in the range given to the virtual network. I used 192.168.68.0/22, so the DNS server (dnsmasq) is started by KVM on 192.168.68.1. You can "discover" that by getting the information for the network, then looking at the IP address assigned to the bridge device:

sauer@lightning:~> sudo virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 caasp-dev-net        active     no            yes
# creating a new VG with the second hard disk in the system
sudo virsh pool-define-as default logical - - /dev/sdb libvirt_lvm /dev/libvirt_lvm
sudo virsh pool-build default --overwrite
sudo virsh pool-start default
# as a directory
sauer@helium:~/kubic-project/automation> virsh pool-edit default
<pool type='dir'>
<name>default</name>
<uuid>fdab5cc0-94a6-4349-892c-1fe133158406</uuid>