Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am chuckg on github.
* I am chuckg (https://keybase.io/chuckg) on keybase.
* I have a public key ASCkswF1EDD0Uo5UlC74VSBNQ8uDOnNhs0CVeDvNFHRZ0wo
To claim this, I am signing this object:
@chuckg
chuckg / gist:a6ee0bba4a8059c80505b0929a780150
Created August 28, 2017 22:33
Splunk Macro: Convert IP to AWS hostname
# $ip$ is the macro argument
| rex mode=sed field=$ip$ "s/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ip-\1-\2-\3-\4/g"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chuckg
chuckg / go_clone.sh
Created January 9, 2017 22:56
golang tools
go_clone_usage() {
echo
echo 'HEY DUMBO ... the following variables must be exported:'
echo
echo " - \$REPO_UPSTREAM"
echo " - \$REPO_FORK"
echo
echo 'Usage:'
echo
echo " REPO_UPSTREAM=github.com/klarna/eremetic"
@chuckg
chuckg / search_density.xml
Created October 31, 2016 20:14
A dashboard for looking at the density of searches by keyword in your Splunk Cluster. Currently relies on the Search Activity app and the indexes it creates for some of the statistic generation.
<form>
<label>Search Density</label>
<fieldset submitButton="true" autoRun="false">
<input type="time" token="datetime" searchWhenChanged="false">
<label></label>
<default>
<earliest>-60m@m</earliest>
<latest>now</latest>
</default>
</input>
@chuckg
chuckg / UserOptions.ini
Last active August 29, 2015 14:26
h1z1 options, largely from: http://h1z1live.com/fps-optimization/ -- when you're happy with your settings, make sure to set the file to Read-Only.
[Display]
FullscreenRefresh=0
Maximized=0
FullscreenWidth=1360
FullscreenHeight=768
WindowedWidth=1920
WindowedHeight=993
Mode=Windowed
FullscreenMode=FullscreenWindowed
HDPixelPlus=1.100000
@chuckg
chuckg / unfuck_mavericks.sh
Created March 31, 2015 18:59
Unfuck your Mac's networking after using VPN, changing WIFI, etc.
#!/bin/bash
sudo networksetup -setv4off Wi-Fi
sleep 1
sudo networksetup -setv6off Wi-Fi
sleep 1
sudo networksetup -setdhcp Wi-Fi
sleep 1
sudo networksetup -setv6automatic Wi-Fi
sleep 1
@chuckg
chuckg / instructions.md
Last active August 29, 2015 14:17
Install OSX command line tools (sudo password required)
  • Open AppleScript
  • Paste the xcode-select-install.osa script into the edit.
  • Save the file as xcode-select-install.app, select "Application" from the "File Format" option.

It's important the app is saved with exact name specified or it won't be able to skip the accessibility confirmation when run.

Seeing LSOpenURLsWithRole() failed with error -10810 for the file /var/tmp/xcode-select-install.app? Run: command "chmod +x xcode-select-install.app/Contents/MacOS/applet"

@chuckg
chuckg / include_recipe_helper.rb
Last active October 19, 2017 07:33 — forked from hartmantis/spec_helper.rb
ChefSpec/RSpec 3 stubs for testing a recipe in isolation
# Updated for rspec 3.0:
module IncludeRecipeHelper
def enable_stubbed_include_recipe
# Don't worry about external cookbook dependencies
allow_any_instance_of(Chef::Cookbook::Metadata).to receive(:depends)
# Test each recipe in isolation, regardless of includes
@included_recipes = []
allow_any_instance_of(Chef::RunContext).to receive(:loaded_recipe?).and_return(false)
allow_any_instance_of(Chef::Recipe).to receive(:include_recipe) do |recipe, included_recipe|
@chuckg
chuckg / nodename.rb
Created May 2, 2014 21:57
Add Chef node name to the IP address during knife-ssh commands
# Tested with:
# * Ruby 2.0
# * Chef 11.6.2
require 'chef/knife'
require 'chef/knife/ssh'
module Nodename
def self.prepended(base)