Skip to content

Instantly share code, notes, and snippets.

View H2so4's full-sized avatar

OkezieE H2so4

  • Salesforce
  • Remote
View GitHub Profile
#!/usr/bin/env/ruby
require 'socket'
# AWS API Credentials
AWS_ACCESS_KEY_ID = "your-aws-access-key-id"
AWS_SECRET_ACCESS_KEY = "your-aws-secret-access-key"
# Node details
NODE_NAME = "webserver-01.example.com"
<% unless @chef_requires.empty? %>
<%= @chef_requires.inspect %>.each do |lib|
begin
require lib
rescue LoadError
Chef::Log.warn "Failed to load #{lib}. This should be resolved after a chef run."
end
end
<% end %>
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 R2 Core x64 and Windows 2008 SP2 x86 AMIs provided
# by Amazon
#
# To run the script, open up a PowerShell prompt as admin
# PS> Set-ExecutionPolicy Unrestricted
# PS> icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/gist/1672426/Bootstrap-EC2-Windows-CloudInit.ps1'))
@H2so4
H2so4 / .vimrc
Last active January 4, 2016 09:09
" Base file borrowed from JOHN KUGELMAN (Thanks much)
" -------This allows you to paste without the auto-indent craziness---
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
#!/usr/bin/env python
'''
Send memory usage metrics to Amazon CloudWatch
This is intended to run on an Amazon EC2 instance and requires an IAM
role allowing to write CloudWatch metrics. Alternatively, you can create
a boto credentials file and rely on it instead.
Original idea based on https://github.com/colinbjohnson/aws-missing-tools
'''
import os
import os.path
import re
import time
import json
# script to create an ssh tunnel from a public server back to a private (firewalled/NATted) machine; a poor man's VPN, basically
# how it works:
# private machine run this script at regular intervals, which attempts to ssh into public server; if successful, it
aptitude install -y build-essential
wget "http://downloads.sourceforge.net/project/e1000/ixgbevf stable/2.11.3/ixgbevf-2.11.3.tar.gz"
tar -zxf ./ixgbevf-*
cd ixgbevf*/src
make install
modprobe ixgbevf
sudo update-initramfs -c -k all
echo "options ixgbevf InterruptThrottleRate=1,1,1,1,1,1,1,1" > /etc/modprobe.d/ixgbevf.conf
@H2so4
H2so4 / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-menu/core-submenu.html">
@H2so4
H2so4 / install_sensu
Last active August 29, 2015 14:16
Install sensu server on ubuntu in a single shot - dependencies and all
cat > client.json <<'EOF'
{
"client": {
"name": "sensu-server.dom.tld",
"address": "10.0.0.1",
"subscriptions": [ "test" ]
}
}
EOF