Skip to content

Instantly share code, notes, and snippets.

View briancline's full-sized avatar

Brian Cline briancline

  • SoftLayer / IBM Cloud
  • Dallas, Texas
View GitHub Profile
@briancline
briancline / ceph-grow-rbd-xfs
Last active September 16, 2020 13:42
Growing a Ceph RBD volume and an XFS filesystem contained within
# df -h /dev/rbd0
Filesystem Size Used Avail Use% Mounted on
/dev/rbd0 1.5T 1.5T 557M 100% /mnt/media
# rbd info media/media01
rbd image 'media01':
size 1536 GB in 393216 objects
order 22 (4096 kB objects)
block_name_prefix: rb.0.1098.74b0dc51
format: 1
@briancline
briancline / ifcfg-he-ipv6
Created March 5, 2014 03:45
HE.net IPv6 Tunnel Broker - CentOS/RHEL/Fedora NIC config
DEVICE="he-ipv6"
DEVICETYPE=sit
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6TUNNELIPV4=184.105.253.10
IPV6TUNNELIPV4LOCAL=XXX.XXX.XXX.XXX
IPV6ADDR=2001:470:YYYY:YYYY::2/64
IPV6_DEFAULTGW=2001:470:YYYY:YYYY::1
@briancline
briancline / 0wtfisthis.md
Last active June 2, 2018 19:18
ubuntu-17.10: Fix resolver behavior for dhclient when systemd-resolved is disabled (fall back to resolvconf)

The problem

So systemd-resolved has bugs. Disabling and stopping systemd-resolved to escape these is the logical step, but a dhcp-managed system does gracefully not fall back to resolvconf-managed file even though dhclient still executes the hook for it. As a result, you're then left with a broken resolv.conf that never gets updated by dhclient.

The reason is the systemd-resolved hook in dhclient only checks to see whether it is executable, and not whether it is also enabled. As a result, it still overwrites the default make_resolv_conf shell function with systemd-resolved logic. Since the resolvconf hook is executed before the resolved hook, you either have to rename it to a name that sorts after resolved, or symlink it thusly; but this doesn't fix the bug.

This diff fixes the resolved hook to actually check for the enabled state of the service in addition to checking whether it is executable. Not the best sequence of steps -- better to check the binary's executable state first, then check whe

@briancline
briancline / data.sql
Created May 4, 2018 03:03
Extra flair for CRDB bug report
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.3 (Ubuntu 10.3-1.pgdg16.04+1)
-- Dumped by pg_dump version 10.3 (Ubuntu 10.3-1.pgdg16.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
@briancline
briancline / 00-readme.md
Last active February 22, 2017 05:37
Test Swift installation (multi-node)

These are based on updated instructions for the Swift multi-node setup guide.

Steps to install on Ubuntu 14.04, assuming at least two machines:

  1. Copy the below 3 scripts to each of your VMs (make sure to chmod +x each of them as well).
  2. Run 01-install-proxy-node.sh only on your proxy.
  3. Run 02-install-storage-node.sh only on each of your storage nodes, prefixing the command with NODE=1, where 1 is the number for that storage node (must start at 1 and increment). For instance: NODE=1 ./02-install-storage-node.sh on your first storage node, NODE=2 ./02-install-storage-node.sh on your second storage node, etc.
  4. For each of the exports provided to you by the storage node install script (STORAGE_N_IP and STORAGE_N_DISKS), copy and paste them into your shell on the proxy. Then, running set | grep -a '^STORAGE_' from your proxy should show you all the storage nodes' exports.
  5. On the proxy, run 03-build-rings.sh. It will show you all the nodes and disks it discovered from your environment, build the
@briancline
briancline / vpnc-script
Created December 31, 2016 22:33 — forked from dzderic/vpnc-script
A custom OpenConnect script to set DNS using `networksetup` on OSX, which makes it work with things that don't read from `/etc/resolv.conf`
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <dwmw2@infradead.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@briancline
briancline / swapping-processes.sh
Last active December 14, 2016 19:00
swapping-processes.sh
#!/bin/bash
# swapping-processes.sh
# Lists all processes swapping memory and their pid and swap usage amounts
# - rev 0.4, 2016-12-14, Brian Cline - remove needless tmpfile usage, honor term widths, simplify
# - rev 0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting
# - rev 0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output
# - rev 0.1, 2011-05-27, Erik Ljungstrom - initial version
print_bar () {
root@saio:/opt/go/src/github.com/openstack/swift/go# make get test all
go get -t ./...
go vet ./...
go test -cover ./...
? github.com/openstack/swift/go/bench [no test files]
? github.com/openstack/swift/go/client [no test files]
? github.com/openstack/swift/go/cmd [no test files]
ok github.com/openstack/swift/go/hummingbird 4.325s coverage: 62.1% of statements
ok github.com/openstack/swift/go/middleware 0.009s coverage: 82.7% of statements
ok github.com/openstack/swift/go/objectserver 3.399s coverage: 71.0% of statements
@briancline
briancline / hands-off-my-scrollwheel-asshole.js
Last active May 24, 2016 05:17
Prevent brain-dead UI/UX terrorists from crapping on OS-native scrolling / touchpad behavior
/*
* Copied for updates/additions from this Chrome extension (highly recommended):
* "Smooth Scroll Sucks" (vong.io)
* https://chrome.google.com/webstore/detail/smooth-scroll-sucks/bpbeihnjhalcfmjbcdafhdmcedknoflm
*
* If you're a UX terrorist who thinks it's "super cool" or "totally sweet" to
* to hijack the scrollwheel/trackpad to make things horrifically slow: stop.
* Just stop it with that shit. This is not good behavior. Your site actually
* provides the perceived feedback of a pile of mayonnaise slowly sliding down
* the edge of the world's largest turd.
Starting with keystonemiddleware v4.5.0 (specifically, commit
f54ff06c1f5e274ea31ffac5faf1f57557fe586a), if a token is found to be cached but
is cached with an invalid state, the middleware attempts to log a debug message
indicating as much. However, the logger it references does not exist and
results in an AttributeError. As a result, this yields HTTP 500 responses once
the invalid token gets cached, rather than 401s.
To reproduce (in my case, with Swift using keystonemiddleware in the pipeline):
1. As expected, this fails with a 401: