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 / gist:8293795
Last active January 2, 2016 10:59
Capture video and broadcast via gstreamer (0.10... gag)
#!/usr/bin/env bash
CAP_WIDTH=320
CAP_HEIGHT=240
CAP_FRAMERATE=30
BIND_HOST=10.0.0.55
BIND_PORT=8080
gst-launch-0.10 v4l2src \
! video/x-raw-yuv,width=$CAP_WIDTH,height=$CAP_HEIGHT,framerate=\(fraction\)${CAP_FRAMERATE}/1 \
@briancline
briancline / coffin-transcode.py
Last active January 2, 2016 14:09
Complete with notes on exciting space-shifting case law.
#!/usr/bin/env python
"""
This script was written to transcode disk-based backups of my DVDs of the
entire original Dark Shadows television series.
After I purchased the full, expensive-but-worthwhile, 1225-episode, 131-disc
box set from Amazon, I was surprised to see it command such size and weight.
The photograph on Amazon did it no justice. Not to mention the box set is
actually shaped like a coffin, complete with coffin door. So, when you want to
@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 () {
@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

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@briancline
briancline / 01-syslog
Last active January 4, 2016 02:19
In which I nearly cry but manage to recover a filesystem after lots of kernel-spewing fun following two rsyncs into two separate XFS filesystems atop two RBD block devices in a Ceph cluster ... several days after having resized both block devices and filesystems with an extra TB of headroom (the Ceph MDS, MON, and OSDs sit on separate machines)
Try to imagine waking up to 238,735 instances of the following in your /var/log/syslog:
Jan 21 06:26:27 file02 kernel: [2345317.437153] end_request: I/O error, dev rbd3, sector 1283882888
Jan 21 06:26:27 file02 kernel: [2345317.437196] XFS (rbd3): page discard on page ffffea0004e52920, inode 0x21805b, offset 713658368.
Jan 21 06:26:27 file02 kernel: [2345317.456204] ffff8801e954e000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Jan 21 06:26:27 file02 kernel: [2345317.463896] XFS (rbd3): Internal error xfs_alloc_read_agf at line 2138 of file /build/linux-rrsxby/linux-3.2.51/fs/xfs/xfs_alloc.c. Caller 0xffffffffa04ff6d3
Jan 21 06:26:27 file02 kernel: [2345317.463898]
Jan 21 06:26:27 file02 kernel: [2345317.487061] Pid: 29356, comm: flush-250:0 Tainted: G C 3.2.0-4-amd64 #1 Debian 3.2.51-1
Jan 21 06:26:27 file02 kernel: [2345317.487064] Call Trace:
@briancline
briancline / gist:8561195
Last active January 4, 2016 03:19
Adjusting PGs to better distribute OSD utilization (hopefully)
file02.ads1:~% date
Wed Jan 22 09:23:42 CST 2014
file02.ads1:~% ssh root@heap01 'df -h $(mount | awk "/osd.ceph-/ {print \$3}" | sort)'
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 2.8T 1.6T 1.2T 57% /var/lib/ceph/osd/ceph-0
/dev/sdc1 2.8T 1.6T 1.2T 59% /var/lib/ceph/osd/ceph-4
/dev/sdd1 2.8T 2.1T 705G 75% /var/lib/ceph/osd/ceph-6
file02.ads1:~% ssh root@heap02 'df -h $(mount | awk "/osd.ceph-/ {print \$3}" | sort)'
# ~/.config/fish/commands/gitignore.fish
function gitignore
if test (count $argv) -lt 1
echo "Usage: gitignore <language name>"
echo ""
echo "Downloads a handy pre-made gitignore file for a given language."
echo "Full list available at https://github.com/github/gitignore."
return 1
end
@briancline
briancline / forfuckssake.txt
Created February 7, 2014 03:02
“uh oh” (heap02:/dev/sde was added today to replace the problematic sdc)
discovery:~% ssh heap01 'df -h | grep osd'
/dev/sdb1 2.8T 2.3T 463G 84% /var/lib/ceph/osd/ceph-0
/dev/sdc1 2.8T 2.1T 646G 77% /var/lib/ceph/osd/ceph-4
/dev/sdd1 2.8T 2.3T 521G 82% /var/lib/ceph/osd/ceph-6
discovery:~% ssh heap02 'df -h | grep osd'
/dev/sdb1 2.8T 2.7T 53G 99% /var/lib/ceph/osd/ceph-1
/dev/sdc1 1.9T 1.9T 2.4G 100% /var/lib/ceph/osd/ceph-3
/dev/sdd1 2.8T 2.7T 80G 98% /var/lib/ceph/osd/ceph-5
/dev/sde1 2.8T 929G 1.9T 34% /var/lib/ceph/osd/ceph-2
@briancline
briancline / optimize-images.sh
Last active August 29, 2015 13:56
Parallel stuff on the shell with gnu parallel utility
#!/usr/bin/env bash
## You can use this to crush images in parallel via the shell alone.
## Make sure the GNU parallel utility is installed:
## - apt-get install parallel
## - yum install parallel
## For a simple example, run the following to simulate with echo and sleep:
## ls --color=no /usr/share/doc | parallel -j 16 --gnu -i -- 'sh -c "sleep 0.5 && echo {}"'
## (-i tells parallel to substitute a filename when it sees {} in the command, rather than
## simply appending it to the command, as it would normally do if you omit -i)