Skip to content

Instantly share code, notes, and snippets.

View gnilchee's full-sized avatar

Greg Nilchee gnilchee

  • Evernote
  • Woodinville, WA
View GitHub Profile
@gnilchee
gnilchee / service.pp
Last active August 29, 2015 14:10
puppet manifest ensuring all lamp components are running and enabled
if versioncmp($::puppetversion,'3.7.3') >= 0 {
$allow_virtual_packages = hiera('allow_virtual_packages',false)
Package {
allow_virtual => $allow_virtual_packages,
}
}
node 'node_name' {
@gnilchee
gnilchee / lamp.pp
Last active August 29, 2015 14:10
puppet manifest ensure vital lamp components installed.
if versioncmp($::puppetversion,'3.7.3') >= 0 {
$allow_virtual_packages = hiera('allow_virtual_packages',false)
Package {
allow_virtual => $allow_virtual_packages,
}
}
node 'node_name' {
@gnilchee
gnilchee / ip.php
Created November 7, 2014 16:49
php code to obtain and display requestor's public ip address
<?php echo $_SERVER["REMOTE_ADDR"];echo "\r\n"; ?>
@gnilchee
gnilchee / .htaccess
Created November 4, 2014 11:31
redirect only a certain naked domain to www, it will ignore subdomains
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
@gnilchee
gnilchee / .htaccess
Created November 2, 2014 07:45
redirect ANY naked domains to www.domain.tld
## This is to allow all incoming naked domains to be rewritten as www.domain.tld
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]