Skip to content

Instantly share code, notes, and snippets.

Creates KVM vm, visible in virt-manager (virsh)
virt-install \
--name ubuntu_server_containers \
--memory 2048 \
--vcpus 2 \
--cpu host \
--cdrom /home/fred/Downloads/ubuntu-17.10-server-amd64.iso \
--disk path=/blacknas/vm_linux_server/ubuntu2.qcow2,size=30 \
--network bridge=br_vms \
--os-type linux \
#!/bin/bash
# This script starts a manjaro vm with following features:
# 1.higly optimized CPU setup with pinning
# 2. q35 machine type
# 3. RAM memory using hugepages
# 4. GPU-passthrough with vfio
# 5. usb-controller passthrough via PCI
# 6. bridged network
#!/bin/bash
# this starts an OSX High Sierra VM. Highly optimized setup with GPU and USB controller passthrough.
# Everything works great except the sound.
#virsh nodedev-list | grep pci
virsh nodedev-detach pci_0000_00_14_0
MY_OPTIONS="+aes,+xsave,+avx,+xsaveopt,avx2,+smep"
#!/bin/bash
# This starts a highly tuned Windows 10 VM with GPU-passthrough, Q35 chipset, ethernet bridging, PCI passthrough for the USB controller, hugepages, etc.
# QEMU name and PID
OPTS="-name windows-10-home"
OPTS="$OPTS -pidfile /tmp/windows-10-pro.pid"
# Processor core2duo qemu64 host
# OPTS="$OPTS -cpu qemu64,kvm=off,hv_vendor_id=123456789asx"
OPTS="$OPTS -cpu host,kvm=off,hv_vendor_id=123456789ab,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff"
<domain type='kvm' id='2'>
<name>ubuntu_server_containers</name>
<uuid>71a365e9-31a0-4596-9a57-a8374365f066</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
<vcpu placement='static'>2</vcpu>
<resource>
<domain type='kvm' id='1'>
<name>ubuntu_server_containers</name>
<uuid>71a365e9-31a0-4596-9a57-a8374365f066</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
<vcpu placement='static'>2</vcpu>
<resource>
#!/bin/bash
BITRATE="128k"
SAVEIF=$IFS
IFS=$(echo -en "\n\b")
for file in $(ls *mp3)
do
name=${file%%.mp3}
outname="${name}_${BITRATE}.mp3"
#!/usr/bin/env perl
use File::Basename;
use Cwd 'abs_path';
use 5.014;
use strict;
use warnings;
use utf8;
my $CRF=18;
my $PRESET="slow";
def print_df_markdown(df, index=True):
"""
This prints a pandas dataframe in a form ready to be used as a markdown table.
Simply print and copy-paste to your hot, new blog post.
"""
print()
cols = list(df)
if index:
cols = ['Index'] + cols
header = ' | '.join(cols)
#!/usr/local/bin/python3
import glob
import subprocess
import argparse
parser=argparse.ArgumentParser()
parser.add_argument('out_file', type=str, help='the output audio file', default='out.mp3')
args = parser.parse_args()
args = args.__dict__