Skip to content

Instantly share code, notes, and snippets.

View purpleidea's full-sized avatar

James purpleidea

View GitHub Profile
#!/usr/bin/python
# James Shubin, @purpleidea, 2016+, AGPLv3+
# Count number of files in each package, and figure out which has the most
# We took a string based parsing approach to the xml filelists for simplicity
# When I ran this, the max was: kcbench-data-4.0, with 52116 files
# Verify with dnf repoquery --quiet -l kcbench-data-4.0 | wc -l
# To run this script, do something like the following:
# wget http://mirror.its.dal.ca/pub/fedora/linux/releases/23/Everything/x86_64/os/repodata/874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml.gz
# gunzip 874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml.gz
# time cat 874f220caf48ccd307c203772c04b8550896c42a25f82b93bd17082d69df80db-filelists.xml | ./dnf_count_files.py > /tmp/output
#
# mgmt grouping analysis - 29/mar/2016
# By: James Shubin <james@shubin.ca>
# https://ttboj.wordpress.com/2016/03/30/automatic-grouping-in-mgmt/
#
* Comparison of different backends for package installation
* All times are in seconds. All tests ran with warm caches. Longer is worse.
* Data was collected from multiple runs but only one sample of each shown here.
* Accompanying spreadsheet with full data is also available.
@purpleidea
purpleidea / rluks.sh
Created April 25, 2016 17:43
Mount your encrypted LUKS drives by uuid over SSH
#!/bin/bash
# rluks.sh: Mount your encrypted LUKS drives by uuid over SSH
# Copyright (C) 2016+ James Shubin, AGPLv3+
# Written by James Shubin <james@shubin.ca>
# You probably want to modify the following globals to match your needs...
SERVER='server.example.com' # expected server for running script
HOSTNAME='myserver' # expected hostname for running locally
MEDIA='/media/' # mount/media directory, eg: /media/
declare -A MAP # create an associative array
15/Jun/2016
The other day, Chef announced an "application automation" system called Habitat. [1] Not too surprisingly, a lot of people have asked for my opinion about it, so I might as well collect some of my thoughts here.
First off, let me say that I like the Chef team and I welcome new projects in this space - especially when they're open source. Most of my early config management work has been with Puppet, but I think that Chef got a lot of things right, and they've also done an amazing job around community and avoiding open core. Nathen Harvey has no doubt been a driving influence here, and he's always been a pleasure to talk to at conferences. It's also worth mentioning that while my recent work on #mgmtconfig [2] has been heavily influenced from my time hacking on Puppet, I've tried to borrow ideas and draw inspiration from Chef concepts when they were more appropriate than what Puppet was doing.
The Habitat project was made public with almost 1800 commits so far. I really wish that if organizations
#!/bin/bash
# james shubin, agplv3+
# pause until key press and then continue
# https://ttboj.wordpress.com/2017/01/06/ten-minute-hacks-process-pause-resume
if [ ! "$#" -eq 1 ]; then
echo "Usage: `basename $0` <process>"
echo "Pauses process until key press and then continues!"
exit 1
fi
use strict;
use vars qw($VERSION %IRSSI);
#use Data::Dumper;
#local $Data::Dumper::Terse = 1;
use Irssi;
$VERSION = '0.0.4';
%IRSSI = (
name => 'fnotify',
authors => 'James Shubin',
#!/bin/bash
# Simple script to count the number of $pattern in each file
# Copyright (C) 2013+ James Shubin
# Written by James Shubin <james@shubin.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# -*- coding: utf-8 -*-
"""
HTTPDaemon simple non-blocking, threaded HTTPD server
Example:
serveraddr = ('', 8000)
server = MultiThreadedHTTPServer(serveraddr, SimpleHTTPServer.SimpleHTTPRequestHandler)
server.serve_forever() # blocks here
print 'Server has quit.'
commit b870395fe3f82eaab7c146d83b3a3f0cab2b63f6
Author: James Shubin <james@shubin.ca>
Date: Mon Jan 28 04:44:59 2013 -0500
Inline image display and storage
This patch adds two forms of inline image storage.
1) Inline storage of a png file within the python source code. This is
especially useful so that the user can offer a pretty front end, without
having to clutter their ~/bin with additional files.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Droopy (http://stackp.online.fr/droopy)
# Copyright 2008-2012 (c) Pierre Duquesne <stackp@online.fr>
# Copyright (C) 2012-2013 James Shubin <james@shubin.ca>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.