Skip to content

Instantly share code, notes, and snippets.

View paulmey's full-sized avatar

Paul Meyer paulmey

View GitHub Profile
@paulmey
paulmey / dstat_mem_commit.py
Created November 7, 2022 10:35
Dstat plugins
class dstat_plugin(dstat):
"""
Committed memory usage
Displays the committed memory.
"""
def __init__(self):
self.name = 'commit memory usage'
self.nick = ('limit', 'committed', 'perc')
self.vars = ('CommitLimit', 'Committed_AS', 'Committed_perc')
@paulmey
paulmey / 99-mjpg-streamer-v4l.rules
Created October 11, 2020 07:11
Files to start mjpg_streamer automatically when /dev/video0 is available
# /etc/udev/rules.d/99-mjpg-streamer-v4l.rules
# Tells udev to tell systemd to start mjpg-streamer when /dev/video0 pops up
SUBSYSTEM=="video4linux", KERNEL=="video0", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="mjpg-streamer@$name.service"
@paulmey
paulmey / _instructions.md
Last active July 17, 2019 03:59
This program demonstrates that Packer hangs when long lines need to be logged.
  1. go build -o packer-builder-bug
  2. PACKER_LOG=1 ./packer build test.json
@paulmey
paulmey / iostat.sh
Created June 15, 2018 15:26
IO pattern captures
# timestamped, Mbps, extended disk stats as csv, ready for import into Excel
iostat -tmxd 5 | awk '{OFS=","} NF==3 {ts=$0} NR==4 {NF=NF;print "Timestamp",$0} NF==14 && $1!~/^Dev/ {NF=NF;print ts,$0 }'
@paulmey
paulmey / vmarmid
Last active March 30, 2018 21:21
displays vm info on azure
#!/bin/bash
curl -sH Metadata:true "http://169.254.169.254/metadata/instance/compute?api-version=2017-08-01&format=json"|jq '"/subscriptions/"+.subscriptionId+"/resourceGroups/"+.resourceGroupName+"/providers/Microsoft.Compute/virtualMachines/"+.name' -r
@paulmey
paulmey / az-create-vm-from-sas-image
Last active March 7, 2019 22:50
Create a VM from a SAS image
#!/bin/bash -e
usage() {
cat >&2 <<EOF
Usage: az-create-vm-from-sas-image -g resource-group -n vmname -l location -i image-sas-uri [-c custom-data]
EOF
exit -1
}
vmcreateopts=""
@paulmey
paulmey / ubuntu-core-mounts.txt
Created June 16, 2017 21:36
Listing of the mount points of a ubuntu core 16 VM
TARGET SOURCE FSTYPE OPTIONS [38/6534]
/ /dev/loop0 squashfs ro,relatime
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup tmpfs tmpfs rw,mode=755
│ │ ├─/sys/fs/cgroup/systemd cgroup cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd
│ │ ├─/sys/fs/cgroup/devices cgroup
@paulmey
paulmey / cloud-config.yml
Last active December 7, 2018 16:39
Repro cloud-init setup_fs bug
#cloud-config
# vim: syntax=yaml
disk_setup:
/dev/sdc:
table_type: gpt
layout: true
overwrite: true
fs_setup:
@paulmey
paulmey / create-managed-disk.json
Last active May 2, 2017 18:37
Create managed disk from platform image
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"diskName": {
"type": "string"
},
"imageUri": {
"type": "string"
},
#!/bin/bash -ex
images="OpenLogic:CentOS:6.8
OpenLogic:CentOS:7.3
credativ:Debian:7
credativ:Debian:8
RedHat:RHEL:6.8
RedHat:RHEL:7.3
SUSE:SLES:11-SP4
SUSE:SLES:12-SP2