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 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
import time
import socket
import base64
src = '192.168.1.2' # ip of remote
mac = '00-AB-11-11-11-11' # mac of remote
remote = 'python remote' # remote name
dst = '192.168.1.3' # ip of tv
app = 'python' # iphone..iapp.samsung
@H2so4
H2so4 / preseed-fragment.seed
Created September 29, 2015 20:09 — forked from lorin/preseed-fragment.seed
Automated partitioning with Ubuntu preseed
# Use LVM for partitioning
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. Preseed this away
d-i partman-lvm/device_remove_lvm boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
@H2so4
H2so4 / lxc_web_panel_install.sh
Last active November 26, 2015 16:10
Installer for LXC-Web-Panel with fix for displaying IP address in UI
#!/bin/bash
echo ' _ __ _______ __ __ _ _____ _ '
echo '| | \ \ / / ____| \ \ / / | | | __ \ | |'
echo '| | \ V / | \ \ /\ / /__| |__ | |__) |_ _ _ __ ___| |'
echo "| | > <| | \ \/ \/ / _ \ '_ \ | ___/ _\` | '_ \ / _ \ |"
echo '| |____ / . \ |____ \ /\ / __/ |_) | | | | (_| | | | | __/ |'
echo '|______/_/ \_\_____| \/ \/ \___|_.__/ |_| \__,_|_| |_|\___|_|'
echo -e '\n\nAutomatic installer\n'
if [[ "$UID" -ne "0" ]];then
#!/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 %>