Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
# generate server.xml with the following command: | |
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
# run as follows: | |
# python simple-https-server.py | |
# then in your browser, visit: | |
# https://localhost:4443 | |
import BaseHTTPServer, SimpleHTTPServer | |
import ssl |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
#!/bin/sh | |
# 2021-12-09: | |
# This script is no longer supported! | |
# Apple broke all direct downloads without logging with an Apple ID first. | |
# The number of hoops that a script would need to jump through to login, | |
# store cookies, and download is prohibitive. | |
# Now we all must manually download and mirror the files for this to work at all :'-( | |
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}') |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/bin/bash | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
curl -L https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 10.18.2 | |
mkdir -p /var/log/chef | |
mkdir -p /var/backups/chef | |
mkdir -p /var/run/chef | |
mkdir -p /var/cache/chef | |
mkdir -p /var/lib/chef | |
mkdir /etc/chef | |
cat - >/etc/chef/bootstrap.json <<EOF |
# In Chef, when a resource is defined all its variables are evaluated during | |
# compile time and the execution of the resource takes place in converge phase. | |
# So if the value of a particular attribute is changed in converge | |
# (and not in compile) the resource will be executed with the old value. | |
# Example problem: | |
# Let's consider this situation where there are two steps involved in a recipe | |
# Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed | |
# in converge phase | |
# Step 2 is a Chef resource that makes use of the node attribute that was |
module Vagrant | |
module Provisioners | |
class ChefClient | |
def cleanup | |
env[:ui].info "Attempting to remove client #{env[:vm].config.vm.host_name}" | |
`knife client show #{env[:vm].config.vm.host_name}` | |
if $?.to_i == 0 | |
env[:ui].info "Removing client #{env[:vm].config.vm.host_name}" | |
`knife client delete #{env[:vm].config.vm.host_name} -y` | |
end |
This will demonstrate how to upload build files from Travis CI to S3.
NOTE: Keys have been changed to protect the innocent.
Create an S3 ACL policy, see s3_policy.json for an example.
# | |
# Need to move your initial ~/.chef to ~/.chef-ENV | |
# | |
alias prod="rm ~/.chef; ln -sf ~/.chef-prod ~/.chef; export CHEF_ENV=prod" | |
alias dev="rm ~/.chef; ln -sf ~/.chef-dev ~/.chef; export CHEF_ENV=dev" | |
function knife_env { | |
if [ -e ~/.chef ] ; then | |
echo $( cd -P ~/.chef ; echo ${PWD##*-} ) | |
fi |