Skip to content

Instantly share code, notes, and snippets.

View brandonweeks's full-sized avatar

Brandon Weeks brandonweeks

View GitHub Profile
@brandonweeks
brandonweeks / clean_nps_logs.ps1
Created December 5, 2014 04:53
Clean Windows NPS logs
$files = Get-ChildItem "C:\Windows\system32\LogFiles" -Filter *.log
$len = $files.length - 2
foreach ($file in $files[0..$len]) {
Remove-Item $file.FullName
}
@brandonweeks
brandonweeks / gist:9aaf89059b936c88652a
Last active September 21, 2015 22:52
puppetlabs-apache configuration to implement Mozilla's "modern" SSL profile
apache::mod::ssl::ssl_protocol:
- 'all'
- '-SSLv3'
- '-TLSv1'
apache::mod::ssl::ssl_cipher: "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK"
apache::mod::ssl::ssl_honorcipherorder: "On"
apache::mod::ssl::ssl_compression: true
BEGIN;
DELETE
FROM nics
WHERE identifier LIKE 'tap%'
OR identifier LIKE 'qv%'
OR identifier LIKE 'qbr%';
DELETE
FROM fact_values
WHERE fact_name_id IN (SELECT id
foreman=# SELECT count(*), host_id, identifier FROM nics GROUP BY host_id, identifier HAVING COUNT(*) > 1;
count | host_id | identifier
-------+---------+------------
2 | 776 | eth0
2 | 683 | ovs_system
2 | 670 | ovs_system
2 | 691 | ovs_system
2 | 690 | br_tun
2 | 690 | ovs_system
5 | 593 | br_tun
@brandonweeks
brandonweeks / foreman.sql
Last active November 10, 2015 20:53
Helpful Foreman queries
-- Find hosts where name doesn't match certname
SELECT name,certname
FROM hosts
WHERE name != certname;
-- Find duplicate nics
SELECT count(*), host_id, identifier FROM nics GROUP BY host_id, identifier HAVING COUNT(*) > 1;
-- Cleanup duplicate nics
DELETE FROM nics
#!/bin/bash
#
# generate patches with the following command (zsh):
# git checkout 1.10-square
# git format-patch upstream/1.10-stable ^test
# then copy .patch files to this folder
# set FOREMAN_VERSION the exact version the patches were based from
#
FOREMAN_VERSION='1.10.0-0.1.RC3'
.Scanning /Users/weeks/Development/smart-proxy/modules/puppet_proxy/class_scanner_eparser.rb
An error occurred while Style/StabbyLambdaParentheses cop was inspecting /Users/weeks/Development/smart-proxy/modules/puppet_proxy/class_scanner_eparser.rb.
undefined method `children' for :do_find:Symbol
/Users/weeks/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:98:in `args?'
/Users/weeks/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:83:in `lambda_with_args?'
/Users/weeks/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/style/stabby_lambda_parentheses.rb:27:in `on_send'
/Users/weeks/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:37:in `block (2 levels) in on_send'
/Users/weeks/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:87:in `with_cop_error_handling'
/Users/weeks/.rvm/gems/ruby-2.2.3/gems/rubocop-0.35.1/lib/rubocop/cop/commissioner.rb:36:in `block in on_send'
/Use
/*
* Table enumerating all implemented cipher suites
* Part of public API.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ssl.h"
#include "sslproto.h"
url = '/users/%s/favorites' % client.get('/me').id
while url:
response = client.get(url, order='favorited_at', limit=PAGE_SIZE, linked_partitioning=True)
url = response.next_href if 'next_href' in response.keys() else None
db.tracks.insert_many([track.obj for track in response.collection])
web-router-service: {
<%- if scope.function_versioncmp([@puppetversion, '4.0']) >= 0 -%>
# These two should not be modified because the Puppet 4.x agent expects them to
# be mounted at these specific paths
"puppetlabs.services.ca.certificate-authority-service/certificate-authority-service": "/puppet-ca"
"puppetlabs.services.master.master-service/master-service": "/puppet"
"puppetlabs.services.legacy-routes.legacy-routes-service/legacy-routes-service": ""
<%- else -%>
# These two should not be modified because the Puppet 3.x agent expects them to
# be mounted at "/"