Skip to content

Instantly share code, notes, and snippets.

View kevinkarwaski's full-sized avatar

Kevin Karwaski kevinkarwaski

View GitHub Profile
# 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
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@trinitronx
trinitronx / xcode-cli-tools.sh
Last active January 18, 2024 05:20
Script to download & install XCode Command Line tools on OSX 10.7 or 10.8. Lifted from jedi4ever/veewee template.
#!/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}')
@willurd
willurd / web-servers.md
Last active May 24, 2024 13:07
Big list of http static server one-liners

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.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ejsarge
ejsarge / user-data
Last active December 12, 2015 07:38
Ubuntu user data for bootstrapping chef with the omnibus installer
#!/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
@arangamani
arangamani / chef_attribute_converge.rb
Last active February 20, 2023 02:44
Dynamically update attribute of a Chef resource during converge phase (Node variable assignment in Compile vs Converge)
# 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
@c10l
c10l / Vagrantfile
Created December 6, 2012 11:57
Vagrant delete Chef node and Client on destroy
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
@fnichol
fnichol / README.md
Created October 11, 2012 22:02
orderup - Creates a tarball of Chef cookbooks from a Cheffile for chef-solo

orderup

Description

Creates a tarball of Chef cookbooks from a Berksfile or Cheffile for chef-solo.

Installation

Copy the program to your local machine (perhaps ~/bin?) and install Berkshelf or Librarian-Chef:

@mheffner
mheffner / README.md
Created October 3, 2012 18:11
Upload Travis CI builds to S3

Upload Travis CI builds to S3

This will demonstrate how to upload build files from Travis CI to S3.

NOTE: Keys have been changed to protect the innocent.

Step 1: Create an S3 policy.

Create an S3 ACL policy, see s3_policy.json for an example.

@spheromak
spheromak / bash_profile.sh
Created July 26, 2012 23:20
bashrc and simple aliases for managing multiple chef envs
#
# 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