Skip to content

Instantly share code, notes, and snippets.

View zanshin's full-sized avatar
💭
Making mistakes so you don't have to since 1961.

Mark Nichols zanshin

💭
Making mistakes so you don't have to since 1961.
View GitHub Profile
# -------------------------------------------------------------------
# Color
# -------------------------------------------------------------------
# add colors to terminal (see man ls for details)
CLICOLOR=1
# Order:
# 1. directory, 2. symbolic link, 3. socket, 4. pipe, 5. executable, 6. block special, 7. character special
# 8. executabel with setuid bit set, 9. executable with setgid bit set, 10. directory writable to others, with sticky bit
# 11. directory writable to others, without sticky bit
#
$ speedtest_cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Kansas State University (129.130.48.12)...
Selecting best server based on latency...
Hosted by Wamego Telephone Company (Wamego, KS) [21.96 km]: 13.792 ms
Testing download speed........................................
Download: 79.72 Mbits/s
Testing upload speed..................................................
Upload: 29.65 Mbits/s
@zanshin
zanshin / homedirs
Created December 11, 2014 15:51
iterate over resource_collection
homedirs = []
run_context.resource_collection.each { |resource|
puts resource.cookbook_name
if resource.is_a(Chef::Resource::File) && resource.cookbook_name == 'myCookbook'
homedirs << resource
end
}
@zanshin
zanshin / gist:236ecd36e1dfe22a6854
Last active August 29, 2015 14:10
firewall_rules.rb
# determine if we are an alpha or production node
if node.chef_environment == "ome-alpha"
local_environment = "alpha"
else
local_environment = "prod"
end
# get the list of nodes...
sources = search(:node, "tags:#{node['memcached']['memcached_instance']} AND tags:#{local_environment}")
knife bootstrap ome-vm33.campus.ksu.edu -N ome-vm33.campus.ksu.edu --ssh-user mhn --sudo --run-list "role[est_base], role[ome_base]" --bootstrap-proxy http://www-proxy.ksu.edu:3128
Connecting to ome-vm33.campus.ksu.edu
ome-vm33.campus.ksu.edu knife sudo password:
Enter your password:
ome-vm33.campus.ksu.edu
ome-vm33.campus.ksu.edu Starting first Chef Client run...
ome-vm33.campus.ksu.edu [2014-11-13T09:05:45-06:00] WARN:
ome-vm33.campus.ksu.edu * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ome-vm33.campus.ksu.edu SSL validation of HTTPS requests is disabled. HTTPS connections are still
ome-vm33.campus.ksu.edu encrypted, but chef is not able to detect forged replies or man in the middle
@zanshin
zanshin / .tmux.conf
Created August 20, 2014 12:52
.tmux.conf.
# use UTF8
set -g utf8
set-window-option -g utf8 on
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
# set scrollback history to 10000 (10k)
set -g history-limit 10000
@zanshin
zanshin / tomcat.rb
Created July 30, 2014 14:45
Tomcat recipe and template
I have a cookbook that installs Tomcat7, sets up an `/etc/init.d` service to start, stop, or restart Tomcat, and provides a LWRP to deploy applications to the instance from our Artifactory setup.
It all works with one caveat: Tomcat gets restarted every time the chef-client daemon runs, or every 15 minutes in this case.
Here is the `default` recipe, which installs Tomcat and sets up the service:
# Create a tomcat user
user node['tomcat']['tomcat_user'] do
comment 'tomcat user'
system true
@zanshin
zanshin / Vagrantfile
Created July 24, 2014 15:24
Vargantfile using chef-client as provisoner
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.hostname = "ome-telecom-creditcard-berkshelf"
config.vm.box = "ome-devvm-ubuntu-12.04.4a"
config.vm.box_url = "https://tools.ome.ksu.edu/artifacts/devvm/ome-devvm-ubuntu-12.04.4a.box"
@zanshin
zanshin / ome-alpha-vm1
Created May 15, 2014 17:53
Chef-client run
mhn@ome-alpha-vm1:/etc$ sudo chef-client
Starting Chef Client, version 11.6.2
resolving cookbooks for run list: ["est-ntp", "est-rsyslog", "est-chef-client", "est-ssh", "est-firewall", "est-mount", "estenv-ome", "est-user::required", "ome_wse_accounts", "est-cis-benchmark", "ome_dev_accounts", "ome_tomcat", "ome_tomcat::properties", "ome_nginx", "ome_telecom_creditcard"]
Synchronizing Cookbooks:
- ome_nginx
- ome_tools
- ome_tomcat
- ome_telecom_creditcard
- ohai
- yum
@zanshin
zanshin / gems
Created April 30, 2014 20:52
vargant gems
± gem list ruby-2.1.1
*** LOCAL GEMS ***
addressable (2.3.6)
berkshelf (3.1.1)
berkshelf-api-client (1.2.0)
bigdecimal (1.2.4)
buff-config (0.4.0)
buff-extensions (0.5.0)