Skip to content

Instantly share code, notes, and snippets.

View acharlieh's full-sized avatar
🐻
Rawr

Charlie Huggard acharlieh

🐻
Rawr
View GitHub Profile
@acharlieh
acharlieh / tzinfo.xml
Created August 17, 2019 20:09
Timezone Test Splunk Dashboard
<dashboard>
<label>Timezone Test</label>
<row>
<panel>
<title>User Info</title>
<single>
<title>User Time Zone</title>
<search id="info">
<query>
<![CDATA[
@acharlieh
acharlieh / DualPianos.rb
Last active November 1, 2018 03:22
SonicPi Playground
def bars(k)
n = chord(k,:sus4)
([n[0]]*4 + [n[1]]*2 + [n[0]]*2 + [n[2],n[1]] + [n[0]]*2)
end
use_bpm 200
use_synth :piano
use_debug false
set :key, :C2
alias jpgoptim='find . -iname '"'"'*.jpg'"'"' -exec convert {} -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB {}.new \; -exec bash -c "ls -l {} {}.new | awk '"'"'/\.jpg\$/ {old=\$5;oldf=\$9} /\.jpg\.new\$/ {new=\$5;newf=\$9} END { if(old<=new) print \"rm \" newf; else print \"mv \" newf \" \" oldf }'"'"' " \; | bash -x'

Keybase proof

I hereby claim:

  • I am acharlieh on github.
  • I am acharlieh (https://keybase.io/acharlieh) on keybase.
  • I have a public key ASCTCJPIiM2QV1Bq-J5ffyxWr3k473iamt6WWV4ohHZusAo

To claim this, I am signing this object:

@acharlieh
acharlieh / search.spl
Created May 2, 2017 03:41
Try this out, with a few different time zones, time picker set to a few days or so.
| gentimes increment=1s
[ makeresults
| addinfo
| rename info_max_time -> end info_min_time -> start
| fields start end
| convert timeformat="%m/%d/%y:%H:%M:%S" ctime(*) as *
| format "" "" "" "" "" ""]
| rename starttime -> _time
| fields
| bin span=1h _time as hourly
@acharlieh
acharlieh / script.rb
Last active February 2, 2017 17:09
Quick Script to pull versions of all cookbooks from a node
require 'json'
# Cookbooks from a folder (like when you do a berks vendor)
# json = Dir.glob('./*/metadata.json').collect do |file|
# Cookbooks from a node cache
json = Dir.glob('/var/chef/cache/cookbooks/*/metadata.json').collect do |file|
hash = JSON.parse(File.read(file))
{ hash['name'] => hash['version'] }
end.reduce({}, :merge).to_json
@acharlieh
acharlieh / script.rb
Created August 9, 2016 15:14
Figuring out that one vagrant vault key wasn't updated
require 'chef-vault'
data = JSON.parse(File.open('data_bags/cerner_splunk/license_secrets_keys.json').read())
keys = (data['clients'] + data['admins']).inject({}) do |m,c|
pem = (c == 'knife_workstation') ? 'fake-key.pem' : "pems/#{c}.pem"
private_key = OpenSSL::PKey::RSA.new(File.open(pem).read())
m[c] = private_key.private_decrypt(Base64.decode64(data[c]))
m
end
@acharlieh
acharlieh / 0-Setup
Last active January 28, 2020 19:20
Getting counts of multiple fields
| noop
| stats count
| fields
| eval raw=split("a=3 b=9 ; a=5 b=1 ; a=10 b=10 ; a=5 b=8 ; a=3 b=1 ; a=6 b=9 ; a=4 b=9 ; a=3 b=1 ; a=7 b=7 ; a=5 b=9 ; a=6 b=10 ; a=7 b=10 ; a=6 b=7 ; a=1 b=8 ; a=8 b=7 ; a=6 b=6 ; a=3 b=7 ; a=2 b=8 ; a=9 b=3 ; a=5 b=2 ; a=5 b=8 ; a=8 b=10 ; a=10 b=7 ; a=6 b=1 ; a=2 b=4 ; a=5 b=7 ; a=9 b=5 ; a=6 b=7 ; a=9 b=6 ; a=4 b=10 ; a=10 b=7 ; a=7 b=7 ; a=6 b=6 ; a=6 b=3 ; a=2 b=9 ; a=2 b=7 ; a=2 b=5 ; a=3 b=9 ; a=3 b=9 ; a=1 b=5 ; a=5 b=7 ; a=5 b=3 ; a=6 b=6 ; a=10 b=9 ; a=3 b=2 ; a=10 b=8 ; a=1 b=4 ; a=4 b=4 ; a=2 b=4 ; a=9 b=4 ; a=2 b=1 ; a=3 b=6 ; a=2 b=3 ; a=1 b=9 ; a=10 b=6 ; a=2 b=6 ; a=3 b=3 ; a=10 b=6 ; a=3 b=5 ; a=2 b=5 ; a=5 b=5 ; a=6 b=4 ; a=5 b=5 ; a=6 b=10 ; a=4 b=8 ; a=5 b=1 ; a=3 b=1 ; a=3 b=7 ; a=3 b=4 ; a=6 b=10 ; a=1 b=8 ; a=9 b=9 ; a=8 b=4 ; a=7 b=8 ; a=7 b=9 ; a=1 b=3 ; a=9 b=8 ; a=2 b=3 ; a=7 b=1 ; a=2 b=8 ; a=6 b=3 ; a=6 b=6 ; a=1 b=3 ; a=7 b=1 ; a=8 b=1 ; a=10 b=5 ; a=7 b=6 ; a=2 b=8 ; a=1 b=4 ; a=8 b=6 ; a=5 b=10 ; a=10 b=7 ; a=7 b=4 ; a=10 b=4 ; a=5 b=9 ; a=8 b
@acharlieh
acharlieh / EmailTweaker.java
Last active August 29, 2015 14:21
Using EWS Java API to set custom headers on a draft email
import java.net.URI;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//You'll need: https://github.com/OfficeDev/ews-java-api/
import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.PropertySet;
import microsoft.exchange.webservices.data.core.service.folder.Folder;
import microsoft.exchange.webservices.data.core.service.item.Item;
@acharlieh
acharlieh / gist:36082aefcd60a9029eb7
Created March 20, 2015 13:33
Updating versions script
perl -ne " if (/^(version\s+'\d+\.\d+\.)(\d+)('.*)/) { \$fix = \$2 + 1; print \"\$1\$fix\$3\n\" } else { print }" metadata.rb