Skip to content

Instantly share code, notes, and snippets.

Avatar

redbeard brianredbeard

View GitHub Profile
@brianredbeard
brianredbeard / sshpub-to-rsa
Created Jan 26, 2012 — forked from thwarted/sshpub-to-rsa
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
View sshpub-to-rsa
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@brianredbeard
brianredbeard / logstash.sh
Last active Dec 23, 2015 — forked from slojo404/logstash RPM spec
Updated to more closely follow Linux Standard Build (lsb; http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html) practices as well as more clearly abstract the function of the agent to support separate scripts for shippers, indexers, etc.
View logstash.sh
#!/bin/bash
#
# logstash Startup script for logstash
# chkconfig: 2345 20 80
# description: Logstash is a log shipping, indexing, and collocation tool.
# processname: java
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
@brianredbeard
brianredbeard / syncrepos.sh
Last active Jun 8, 2021
Reposync - A better tool than mrepo. Use this to sync down all channels a RHEL system is subscribed to and turn them into locally exposed yum repositories.
View syncrepos.sh
#!/bin/bash
# This tool can be used to sync down Red Hat based packages from RHN using only Red Hat shipped tools
# Brian "Red Beard" Harrington <brian@dead-city.org>
# Copyright 2013
#
# To satisfy the pre-reqs for this script install the following two rpms:
# yum-utils
# createrepo_c (in RHEL 8 createrepo and createrepo_c have been combined)
# See https://github.com/rpm-software-management/createrepo_c#differences-in-behavior-between-createrepo_c-and-createrepo
@brianredbeard
brianredbeard / init.pp
Created Nov 14, 2013
augeas sample inside of puppet for performing basic configurations
View init.pp
class ipa {
package { [ 'ipa-server', 'bind', 'bind-dyndb-ldap' ]:
ensure => 'installed',
}
augeas { 'nis domain name':
context => "/files/etc/sysconfig/network",
changes => [
"set NISDOMAIN example.com",
@brianredbeard
brianredbeard / hubot
Created Nov 14, 2013
Startup script for a Red Hat SCL based node.js application which should run on startup - Hubot. http://github.com/github/hubot (Note, this isn't a _good_ example, simply _an_ example).
View hubot
#!/bin/bash
# hubot
# chkconfig: 345 20 80
# description: hubot
# processname: hubot
# This script assumes you have a user called "hubot" on your system and that hubot is installed in /opt/hubot
#
# Fore more info on this craziness -
# http://thejacklawson.com/how-to-hubot/
@brianredbeard
brianredbeard / db_dump.sh
Last active Aug 26, 2019
MariaDB / MySQL Backup script
View db_dump.sh
#!/bin/bash
# Simple script to dump the contents of a database into separate files in the directory "/backups/"
# Symlink into /etc/cron.daily/ or add to crontab
# Originally from: https://gist.github.com/brianredbeard
# /usr/local/scripts/db_dump
#mysqldump -x --add-drop-table --all-databases > /backups/mysqldb-`date +%F-%I%p`.sql
/usr/bin/mysql --defaults-extra-file=/root/.my.cnf -e 'show databases' | /bin/awk '{print $1}' | /bin/grep -v "^Database$" | /usr/bin/xargs -i{} /usr/bin/mysqldump --defaults-extra-file=/root/.my.cnf --opt -Q -r /backups/{}-`date +%F-%I%p`.sql {}
@brianredbeard
brianredbeard / tmux.conf
Created Feb 12, 2014
A better starting tmux config. Live like screen, but better
View tmux.conf
# make CTRL+a the 'prefix' ala screen.
bind C-a send-prefix
set -g prefix C-a
# get rid of the tmux standard of CTRL+b
unbind C-b
set -s escape-time 1
set -g base-index 1
setw -g pane-base-index 1
# make it easy to reload the config (CTRL+r)
@brianredbeard
brianredbeard / glance_load.sh
Last active Aug 29, 2015
Glance load - a utility to monitor an ETag and load the corresponding file into glance.
View glance_load.sh
#!/usr/bin/env bash
# glance_load.sh
# Brian "Redbeard" Harrington <brian@dead-city.org>
#
# This code is in the public domain.
#
# A tool for monitoring remote files and loading them into a glance image
# store. This tool has been optimized for use on CoreOS but should work
# for most files where an ETag is exposed.
@brianredbeard
brianredbeard / .config
Created Sep 19, 2014
"corebox" buildroot config
View .config
#
# Automatically generated file; DO NOT EDIT.
# Buildroot 2014.08 Configuration
#
BR2_HAVE_DOT_CONFIG=y
#
# Target options
#
BR2_ARCH_IS_64=y
View keybase.md

Keybase proof

I hereby claim:

  • I am brianredbeard on github.
  • I am brianredbeard (https://keybase.io/brianredbeard) on keybase.
  • I have a public key whose fingerprint is 9244 6DEB CE08 9086 7E4C C634 933F 5408 3D6D F566

To claim this, I am signing this object: