Skip to content

Instantly share code, notes, and snippets.

View hh's full-sized avatar

Hippie Hacker hh

View GitHub Profile
@hh
hh / gitutils.rb
Created February 4, 2014 21:49
rugged library attempt at using gerrit ssh / http remotes
require 'rugged'
require 'digest'
class GitUtils
def initialize(opts={})
path = opts[:path] || Dir.pwd
email = opts[:author_email] || "gerrit@hippiehacker.org"
aname = opts[:author_name] || "Gerrit HH"
@default_repo_name = opts[:repo_name] || "gerrit"
@hh
hh / CreateUserOrgs.mkd
Created March 17, 2014 09:21
Creating Users / Orgs on EC11
echo postgres://opscode_chef@localhost/opscode_chef > /etc/opscode/DATABASE_URI
cd /opt/opscode/embedded/service/opscode-account
bundle exec ./bin/createobjecttool --object-type user -a http://127.0.0.1:9465 --user-password chris4321 --object-name chris4321  --displayname chris4321 --email chris@hippiehacker4321.org --firstname Chris --middlename M --lastname McClimans --key-path /tmp/chris4321-key.pem --opscode-private-key /etc/opscode/pivotal.pem --opscode-username pivotal
bundle exec ./bin/createorgtool -t Business -a http://127.0.0.1:9465   --org-name chris4321 --customer-org-fullname chris4321-fullname  --client-key-path /tmp/chris4321-validator.pem --username chris4321 --opscode-username pivotal --opscode-private-key /etc/opscode/pivotal.pem
@hh
hh / .edge_gateway.sh
Created August 11, 2014 20:37
Attempting to get an edge gateway
[30] pry(main)> conn.get_org_vdc_gateways(conn.organizations.first.id)
excon.request
:body => nil
:chunk_size => 1048576
:ciphers => "HIGH:!SSLv2:!aNULL:!eNULL:!3DES"
:connect_timeout => 60
:debug_request => true
:debug_response => true
:expects => 200
:headers => {
@hh
hh / knife vchs create.sh
Created August 18, 2014 22:27
Knife VCHS create windows server with auto login failing
$ time bundle exec knife vchs server create --winrm-password 'Miocmup4uVszX4y@' --image W2K12-STD-R2-64BIT --bootstrap-protocol winrm --customization-script ./install-winrm-2k12.bat
...
...
...
[1] pry(#<Fog::Compute::VcloudDirector::Real>)> continue
excon.request
:body => "<?xml version=\"1.0\"?>\n<GuestCustomizationSection xmlns=\"http://www.vmware.com/vcloud/v1.5\" xmlns:ovf
=\"http://schemas.dmtf.org/ovf/envelope/1\">\n <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>\n <Enabled>true</E
nabled>\n <ChangeSid>true</ChangeSid>\n <JoinDomainEnabled>false</JoinDomainEnabled>\n <UseOrgSettings>false</UseOrgSettings>\n
<AdminPasswordEnabled>true</AdminPasswordEnabled>\n <AdminPasswordAuto>false</AdminPasswordAuto>\n <AdminPassword>Miocmup4uVsz
@hh
hh / install-winrm-vcair.bat
Created August 19, 2014 22:07
This is a customization script for use with VMware Cloud Air
@echo off
if “%1%” == “precustomization” (
@rem First Boot
echo Setup WinRM for use over HTTP
cmd.exe /c winrm quickconfig -q
cmd.exe /c winrm quickconfig -transport:http
cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"}
cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}
cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"}
@hh
hh / 99-local.rules
Created August 27, 2014 22:02
Detecting external monitor changes and reconfiguring X Displays and reloading Window manager on Arch MacBookAir5,2
# put this in /etc/udev/rules.d
# It's important that it starts with 99 or something high
# If this file is 10-local.rules it will fail to run the scripts
ACTION=="change", SUBSYSTEM=="drm", RUN+="/etc/udev/monitor.change.sh"
@hh
hh / swapd_fix.conf
Created August 28, 2014 04:33
Fix for kswapd0 making system unusable when io and memory usage is high
# On Arch Drop this file into /etc/sysctl.d/
# and run sysctl --system
# on other systems put in /etc/sysctl.conf
# http://discussions.citrix.com/topic/277290-kswapd0-process-consumes-a-guest-vm/#entry1511105
vm.dirty_background_ratio = 3
# (default was 10, had tried 5))
vm.dirty_expire_centisecs = 500
@hh
hh / .add_to_bashrc
Created September 1, 2014 16:06
Unlimited, multi-shell bash history
# From https://github.com/fotinakis/bashrc/blob/master/init.sh#L35
export HISTFILESIZE=
export HISTSIZE=
export HISTIMEFORMAT="[%F %T] "
export HISFILE=~/.bash_eternal_history
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
# https://github.com/joshuacronemeyer/shellsink
# is a centralized web based version for all your shells, I didn't look at it
# but it's an interesting concept
@hh
hh / chef-metal-do-auth
Last active August 29, 2015 14:06
Trouble getting chef-metal to auth
bundle exec chef-client -z ./examples/simple.rb
DL is deprecated, please use Fiddle
Starting Chef Client, version 11.16.0
resolving cookbooks for run list: []
Synchronizing Cookbooks:
Compiling Cookbooks...
[2014-09-09T14:13:52-05:00] WARN: Node mba.grandenetworks.net has an empty run list.
Converging 1 resources
Recipe: @recipe_files::/home/hh/discovery/preview/examples/simple.rb
* machine[mario] action converge
@hh
hh / matching_encrypted_data_bag_secrets
Created September 10, 2014 04:14
Failing to decrypt even when secrets match
[hh@mba test]$ knife data bag show secrets github -s .chef/encrypted_data_bag_secret -k .chef/invalidation.pem -u foo --server-url http://localhost:8889
api_key: aoeuaoeu
api_secret: aoeu
id: github
[hh@mba test]$ ssh -i /home/hh/.chef/keys/metal_default root@192.241.229.152 -R 8889:localhost:8889 knife data bag show secrets github -s /etc/chef/encrypted_data_bag_secret -c /etc/chef/client.rb
ERROR: Chef::EncryptedDataBagItem::DecryptionFailure: Error decrypting data bag value: 'bad decrypt'. Most likely the provided key is incorrect
[hh@mba test]$ cat .chef/encrypted_data_bag_secret
MIIBOgIBAAJBALiIoYZz3vG9NdL1ETExJF884dMTlBN2ikpFNdEu5+M0G0RlK5cS
kEJC93nkWvN0cifjDdxedNsjqe5LtPuosBUCAwEAAQJAQaYB6MZCEzgf9NvQcPKt
oOAU6rW1YTMzwXZbzf5k6pPdK1m9BS5Tsm5r0HLeig4v5A9XqHi7mojIaQDqrTq7