Skip to content

Instantly share code, notes, and snippets.

View brianredbeard's full-sized avatar

redbeard brianredbeard

View GitHub Profile
@brianredbeard
brianredbeard / Dockerfile-OSSEC-HIDS
Created December 1, 2017 16:57
Minimal Dockerfile for the OSSEC host based intrusion detection system
####
#
# BUILD CONTAINER
#
####
FROM alpine:latest as build
# Setup a work environment and retrieve the sources
@brianredbeard
brianredbeard / gh-pubkeys.sh
Created February 11, 2019 23:16
Github Pubkeys - grab all keys from a list of users to generate an authorized_keys file
#!/bin/bash
set -e -u -o pipefail
# Provide a default list of users. This can be overriden by supplying the
# environment variable "USERS"
USERS=${USERS:-'brianredbeard chancez crawford ivancherepov kbrwn'}
for name in ${USERS}; do
curl -Ls http://github.com/${name}.keys | \
@brianredbeard
brianredbeard / ext_mirror.sh
Created September 26, 2018 05:19
Call external script from udev rule - I use this mechanism to fire off xrandr rules when docking my laptop.
#!/bin/sh
# This script will make two connected output sources mirrors of each other:
#
#
# +---------------+ +---------------+
# | | | |
# | Primary | | DisplayLink |
# | Display | | (DP-2-2) |
# | (e-DPI-1) | | (Screen 2/3) |
@brianredbeard
brianredbeard / doorauth.py
Created September 21, 2018 16:20
A simple door script for use with github.com/google/makerspace-auth
#!/usr/bin/python
#
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@brianredbeard
brianredbeard / ldap.awk
Created April 11, 2018 00:10
An awk script for LDIF processing
# Set the following values before any processing occurs:
# RS (record separator) to an empty line
# FS (field separator) to a newline
# OFS (output field separator) to a comma
BEGIN { RS = "" ; FS = "\n" ; OFS=","}
{ for (i=1;i<=NF;i++) {
# Add a line for each field to be extracted, replacing the field name in
# all three spots:
if ($i ~ "^cn: ") { cn=gensub("^cn: ","","g",$i) }
if ($i ~ "^title: ") { title=gensub("^title: ","","g",$i) }
@brianredbeard
brianredbeard / hubot
Created November 14, 2013 01:10
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).
#!/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 / oshprice.ulp
Created December 20, 2017 16:34 — forked from itavero/oshprice.ulp
Eagle CAD ULP script to calculate the price of a PCB when you order it at OSHPark.Currently only works for 2-layer boards.
#usage "en: <b>Calculate the price of a dual-layer PCB if you order them at OSH Park.</b>"
"<p>Usage: run oshprice</p>"
"<p>Author: <author>Arno Moonen &lt;info@arnom.nl&gt;</author><br />"
"Version: <em>201405042026</em></p>"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED
void main() {
if(!board) {
// No board
@brianredbeard
brianredbeard / denoun.py
Created December 5, 2017 18:56
Tool for fixing up CC output from The Noun Project
#!/usr/bin/env python3
# Brian 'redbeard' Harrington
# License: GPLv3
# For my presentations, I'm a huge fan of visual consistency and attribution
# This strips ugliness from assets from the noun projevct and outputs the things
# i need to attribute for my slides
`
import pathlib
import sys
@brianredbeard
brianredbeard / ifcfg-br0
Last active April 23, 2017 19:26
network configs for a vm-bridge on fedora
# /etc/sysconfig/network-scripts/ifcfg-br0
UUID=1d0ce809-703f-452b-910a-50267d8da44f
TYPE=Bridge
NM_CONTROLLED=yes
BOOTPROTO=none
NAME=br0
DEVICE=br0
ONBOOT=yes
TYPE=Ethernet
STP=no
@brianredbeard
brianredbeard / upgrade_unifi.sh
Last active September 21, 2016 02:17 — forked from stevejenkins/upgrade_unifi.sh
Easy UniFi Controller Upgrade Script for Unix/Linux Systems
#!/bin/sh
# upgrade_unifi.sh
# Easy UniFi Controller Upgrade Script for Unix/Linux Systems
# by Steve Jenkins (stevejenkins.com)
# Version 2.0
# Last Updated July 2, 2016
# REQUIREMENTS
# 1) Assumes you already have any version of UniFi Controller installed