Skip to content

Instantly share code, notes, and snippets.

View mbbernstein's full-sized avatar

Michael Bernstein mbbernstein

View GitHub Profile
@peplin
peplin / recipe.rb
Created July 10, 2010 01:30
S3 File Resource for Chef
# Source accepts the protocol s3:// with the host as the bucket
# access_key_id and secret_access_key are just that
s3_file "/var/bulk/the_file.tar.gz" do
source "s3://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
mode 0644
end
@guiambros
guiambros / cloud-init.sh
Created October 22, 2012 01:29
Cloud-Init.sh - Amazon EC2 initial instance setup script (tested with Ubuntu 12.04 LTS)
#!/bin/bash
function getpublickey()
{
x=$(curl -fs http://169.254.169.254/latest/meta-data/public-keys/)
if [ $? -eq 0 ]; then
for i in $x; do
index=$(echo $i|cut -d = -f 1)
format=$(curl -s http://169.254.169.254/latest/meta-data/public-keys/$index/)
echo $(curl -s http://169.254.169.254/latest/meta-data/public-keys/$index/$format)
anonymous
anonymous / cloud-watch.rb
Created March 14, 2013 15:53
Cloud Watch Monitoring Scripts using Chef. Monitors Memory and Disk usage.
### Monitor Memory and Disk utilization with CloudWatch
### Assume that the instance have a IAMRole with CloudWath PutMetricData
### http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts-perl.html
%w{ unzip libwww-perl libcrypt-ssleay-perl }.each do |pkg|
package pkg do
action :install
end
end
@DavidAllison
DavidAllison / s3-file.rb
Created April 1, 2013 22:19
An update to @peplin's work on https://gist.github.com/peplin/470321 that makes this gist compatible with the more modern AWS-SDK gem and new APIs, and updates for Chef 11.x (still works with 10.x too).
#
# Author:: Christopher Peplin (<[email protected]>)
# Copyright:: Copyright (c) 2010 Bueda, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@markhorrocks
markhorrocks / test_google_sheets_apiV4.rb
Last active July 23, 2024 14:34
Editing Google Sheets with the Google::Apis::SheetsV4 Ruby Client
#! /usr/bin/ruby
require 'google/apis/sheets_v4'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
APPLICATION_NAME = 'Google Sheets API Test'
@aronreisx
aronreisx / tutorial-rename-wsl-disto.txt
Created December 11, 2021 19:16
How to rename WSL Distro on Windows
To rename WSL Distros on Windows follow the steps:
1. Stop all instances of WSL
On PowerShell run the command: wsl --shutdown
2. Open Registry Editor and go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
Each subfolder on Lxss represents a distro
3. Locate and rename the distro you want
Inside each distro folder you have the DistributionName, change it and click ok