Skip to content

Instantly share code, notes, and snippets.

set autoindent shiftwidth=4 expandtab tabstop=4
execute pathogen#infect()
syntax on
filetype plugin indent on
nmap :nerdtt :NERDTreeToggle<CR>
@jshen28
jshen28 / linux-userful-commands.md
Last active January 24, 2019 00:51
command cheatsheet

DPKG CHEATSHEET

# Download .deb file from repo
apt downloadd ${PACKAGE_NAME}

# extract control info
dpkg-deb -R ${PACKAGE_NAME} ${TO_WHERE}

# download source build
@jshen28
jshen28 / howto_deb_repackage.txt
Created May 20, 2019 03:28 — forked from shamil/howto_deb_repackage.txt
Howto repackage deb packages
Use folowing steps to repackage dep package:
1: Extract deb package
# dpkg-deb -x <package.deb> <dir>
2: Extract control-information from a package
# dpkg-deb -e <package.deb> <dir/DEBIAN>
3. After completed to make changes to the package, repack the deb
# dpkg-deb -b <dir> <new-package.deb>
@jshen28
jshen28 / multicast-openstack.md
Created August 26, 2019 06:06 — forked from djoreilly/multicast-openstack.md
Multicast on OpenStack

Multicast on OpenStack

The following works with Neutron VLAN provider networks, and requires configuration on the physical switches. Multicast works on br-int because the ML2 OVS driver/agent uses OVS in standalone mode (no external controller). The packets on br-int hit the NORMAL flow action, and so get treated by the ovs-vswitchd code that does IGMP snooping (when enabled). All IGMP packets are sent to the slow path (userspace ovs-vswitchd).

The following will not work on Neutron tunnel backed networks (VxLAN, GRE), as the neutron-openvswitch-agent hardcodes flows on br-tun that treats multicast the same as broadcasts and the NORMAL action is not used.

+----------------------------+      +----------------------------+
|      +----+    +----+      |      |      +----+    +----+      |
|      | VM |    | VM |      |      |      | VM |    | VM |      |
|      +-+--+    +--+-+      |      |      +-+--+    +--+-+      |
ISO_FILE ?= ubuntu.iso
VM_NAME ?= vm06
PATH_TO_HDD ?= $(PWD)/$(VM_NAME).qcow2
.PHONY: mkiso
run: $(VM_NAME).qcow2
/usr/bin/qemu-system-x86_64 \
-m 1024 \
-vnc 0.0.0.0:41 \
@jshen28
jshen28 / route_dump.c
Created June 7, 2020 10:11 — forked from cl4u2/route_dump.c
Linux route monitoring example
/*
iflist.c : retrieve network interface information thru netlink sockets
(c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute
v1.0 : initial version - Feb 19th 2010
This file was obtained at the following address :
http://www.iijlab.net/~jean/iflist.c
@jshen28
jshen28 / route_dump.c
Created June 7, 2020 10:11 — forked from cl4u2/route_dump.c
Linux route monitoring example
/*
iflist.c : retrieve network interface information thru netlink sockets
(c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute
v1.0 : initial version - Feb 19th 2010
This file was obtained at the following address :
http://www.iijlab.net/~jean/iflist.c
6ee73781-6d8c-40f7-b953-ecf30f4a3309] Failed to build and run instance: libvirt.libvirtError: internal error: Process exited prior to exec: libvirt:  error : Unable to move /dev/termination-log mount to /run/libvirt/qemu/631-instance-0000c3a2.termination-log: Permission denied
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309] Traceback (most recent call last):
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309]   File "/var/lib/openstack/lib/python3.8/site-packages/nova/compute/manager.py", line 2394, in _build_and_run_instance
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309]     self.driver.spawn(context, instance, image_meta,
2021-03-17 04:19:59.124 1255432 ERROR nova.compute.manager [instance: 6ee73781-6d8c-40f7-b953-ecf30f4a3309]   File "/var/lib/openstack/lib/python3.8/site-packages/nova/virt/libvirt/driver.py", line 3753, in s