Skip to content

Instantly share code, notes, and snippets.

View pauloconnor's full-sized avatar

Paul O'Connor pauloconnor

View GitHub Profile
#!/bin/bash
echo -n 'conf01';date +%m%y
#!/bin/bash
check_daemon() {
local DAEMON="$1"
ps axo pid,command | grep -i "$DAEMON"
find /Library/LaunchAgents | grep -i "$DAEMON" | while read -sr f; do
echo "launchctl unload $f"
done
find /Library/LaunchDaemons | grep -i "$DAEMON" | while read -sr f; do
echo "launchctl unload $f"
@pauloconnor
pauloconnor / purge.gs
Created January 4, 2016 15:19
Google Script for deleting automated emails
// The name of the Gmail Label that is to be autopurged?
var LABELS = ["alerts-disk-space", "alerts-sensu", "backups", "cron", "janitor-monkey", "nagios", "push", "security-alerts", "svn-git-updates"];
// Purge messages automatically after how many days?
var PURGE_AFTER = "31";
// This is the largest batch size moveThreadsToTrash supports
var BATCH_SIZE = 100
var DELAY_BETWEEN_MS = 1000
@pauloconnor
pauloconnor / unfuck.sh
Created September 9, 2014 11:31
unfuck.sh
#!/bin/sh
sudo networksetup -setv4off Wi-Fi
sudo networksetup -setdhcp Wi-Fi
### Keybase proof
I hereby claim:
* I am pauloconnor on github.
* I am pauloconnor (https://keybase.io/pauloconnor) on keybase.
* I have a public key whose fingerprint is 4E88 D576 B2B2 5983 00F7 2A69 A1E4 35F5 DAAD 4964
To claim this, I am signing this object:

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@pauloconnor
pauloconnor / I work all night
Created May 23, 2013 14:10
lumberjack input
lumberjack {
port => 1555
ssl_certificate => "/opt/lumberjack/ssl.crt"
ssl_key => "/opt/lumberjack/ssl.key"
ssl_key_passphrase => "logstash"
type => "papertrail"
}
@pauloconnor
pauloconnor / gist:5576739
Last active December 17, 2015 07:58
Logstash Twitter crash
Input thread exception {:plugin=><LogStash::Inputs::Twitter type=>"twitter", user=>"USERNAME", keywords=>["something.com", "@something"], charset=>"UTF-8">, :exception=>#<NoMethodError: undefined method `value' for nil:NilClass>, :backtrace=>["file:/opt/logstash/logstash-1.1.12-flatjar.jar!/logstash/inputs/twitter.rb:92:in `track'", "file:/opt/logstash/logstash-1.1.12-flatjar.jar!/logstash/inputs/twitter.rb:56:in `run'", "org/jruby/RubyKernel.java:1409:in `loop'", "file:/opt/logstash/logstash-1.1.12-flatjar.jar!/logstash/inputs/twitter.rb:53:in `run'", "file:/opt/logstash/logstash-1.1.12-flatjar.jar!/logstash/agent.rb:761:in `run_input'", "file:/opt/logstash/logstash-1.1.12-flatjar.jar!/logstash/agent.rb:407:in `start_input'"], :level=>:warn}
Restarting input due to exception {:plugin=><LogStash::Inputs::Twitter type=>"twitter", user=>"USERNAME", keywords=>["something.com", "@something"], charset=>"UTF-8">, :level=>:error}
}
Try:
twitter {
@pauloconnor
pauloconnor / Puppet, HALP!
Created April 19, 2013 10:27
Puppet has a sense of humour!
✗ puppet help help help help help
%%%%
%%%%-(
_%%%%%_/ \ ' /
_%%%%%%%% - (_) -
_%%%%%%%/ \% / , \
%%%%%%%%%\\ \_
%%%%%% \ \\
) /\_/
---
classes: {}
parameters:
puppetmaster: ""
root_pw: {redacted}
foreman_env: production
environment: production