Skip to content

Instantly share code, notes, and snippets.

Avatar

Lars Kellogg-Stedman larsks

View GitHub Profile
@larsks
larsks / gist:3933980
Created Oct 22, 2012
Resizing a filesystem using qemu-img and fdisk
View gist:3933980

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

View collectd_insert.sql
-- Description:
-- ------------
--
-- This is an example schema for storing collectd metrics in a TimescaleDB
-- dabase (see https://www.timescale.com/). It is based on the PostgreSQL
-- schema contributed by Sebastian Harl.
--
-- Prerequisities:
-- ---------------
--
@larsks
larsks / editmsg.py
Created Feb 15, 2021
edit an arbitrary commit message
View editmsg.py
import click
import git
def clone_commit(old, **kwargs):
md = dict(
message=old.message,
parent_commits=old.parents,
author=old.author,
committer=old.committer,
@larsks
larsks / graph.dot
Created Feb 14, 2021
drawing git history with graphviz
View graph.dot
digraph G {
rankdir="LR";
bgcolor="white";
node[width=0.15, height=0.15, shape=circle, color=black, fontcolor=black];
edge[weight=2, arrowhead=none, color=black];
master[shape=box];
topic[shape=box];
node[group=main];
@larsks
larsks / redate.py
Created Feb 14, 2021
Reset date on a series of git commits
View redate.py
import click
import datetime
import git
@click.command()
@click.option('-d', '--date')
@click.argument('base')
def main(date, base):
if date is None:
@larsks
larsks / wait-for-network.ps1
Created Nov 4, 2012
Wait until networking is available with PowerShell
View wait-for-network.ps1
# Wait for a DHCP-enabled interface to develop
# a default gateway.
#
# usage: wait-for-network [ <tries> ]
function wait-for-network ($tries) {
while (1) {
# Get a list of DHCP-enabled interfaces that have a
# non-$null DefaultIPGateway property.
$x = gwmi -class Win32_NetworkAdapterConfiguration `
-filter DHCPEnabled=TRUE |
View gist:68b61d61721e46e839f10993e4995c94
apiVersion: nmstate.io/v1alpha1
kind: NodeNetworkConfigurationPolicy
metadata:
name: br1-ens4-policy
spec:
nodeSelector:
node-role.kubernetes.io/worker: ""
desiredState:
interfaces:
- name: br1
View import-to-pocket.py
#!/usr/bin/python
'''
Import Google Reader starred items to Pocket
============================================
This script will read the list of starred items generated by exporting your
Reader data using [Google Takeout][]. Generally you will use it like this:
python import-to-pocket.py starred.json
View ilana public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQVnALkuZ9s5X4Q6bPkCSueIipTbF3DWZatUu3igO06Jm/BsfxXDWCsD6gXTV8l0rrNLLUfaT+126S3sX7sH8PMiFg8QzHLjL8wO8ANK2qqoCXCHrk7JCWglxF/Fgn0MLYapn7vyEJ6FWkh2eLc7g3WFW+YQTypqzlOq4cS7dZxaXoueL2O3+ZRjoIXLk04XSvNhLRE3C6u5FMGV12tEVw9Wy9GBkBUjv7J/Mbf1jzbuhpe/MZDjyjRLWX4OdKOYfQPYe3OsyInIXHrkLVxxpYBY2877jQqYv/QAVR4j9/n1Ob3H37rRBcZiw8PEejAO/VbKOccQA9FPrdYXwI5rNv ipolonsk@ipolonsk.tlv.csb
@larsks
larsks / create-bridge-network.md
Last active Apr 3, 2020
podman-bridge-network
View create-bridge-network.md

This will work if you have an existing bridge or if you don't: if the bridge referenced in this config doesn't exist, it will be created when you start a container attached to the network.

  1. Create the CNI network configuration in /etc/cni/net.d/99-example.conflist:
{
  "cniVersion": "0.4.0",
  "name": "example",
  "plugins": [
    {